tower_util/optional/error.rs
1use std::{error, fmt};
2
3/// Error returned if the inner `Service` has not been set.
4#[derive(Debug)]
5pub struct None(());
6
7pub(crate) type Error = Box<dyn error::Error + Send + Sync>;
8
9impl None {
10 pub(crate) fn new() -> None {
11 None(())
12 }
13}
14
15impl fmt::Display for None {
16 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
17 write!(fmt, "None")
18 }
19}
20
21impl error::Error for None {}