tower/util/optional/error.rs
1use std::{error, fmt};
2
3/// Error returned if the inner [`Service`] has not been set.
4///
5/// [`Service`]: crate::Service
6#[derive(Debug)]
7pub struct None(());
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 {}