tower/util/optional/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::{error, fmt};

/// Error returned if the inner [`Service`] has not been set.
///
/// [`Service`]: crate::Service
#[derive(Debug)]
pub struct None(());

impl None {
    pub(crate) fn new() -> None {
        None(())
    }
}

impl fmt::Display for None {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        write!(fmt, "None")
    }
}

impl error::Error for None {}