Struct Optional
pub struct Optional<T> { /* private fields */ }
Optionally forwards requests to an inner service.
If the inner service is None, optional::None is returned as the response.
Implementations
impl<T> Optional<T>
const fn new<Request>(inner: Option<T>) -> Optional<T> where T: Service<Request>, T::Error: Into<BoxError>,Create a new
Optional.
Trait Implementations
impl<T, Request> Service<Request> for Optional<T>
where
T: Service<Request>,
T::Error: Into<BoxError>,
type Response = <T as Service<Request>>::Response;type Error = Box<dyn Error + Sync + Send>;type Future = ResponseFuture<<T as Service<Request>>::Future>;fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn call(&mut self, request: Request) -> Self::Future
impl<T: Debug> Debug for Optional<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result