Struct Optional

struct Optional<T> { ... }

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 as >::Error: Into<BoxError>

Create a new Optional.

impl<M, S, Target, Request> MakeService for Optional<T>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future

impl<T> Any for Optional<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Optional<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Optional<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> Freeze for Optional<T>

impl<T> From for Optional<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Optional<T>

impl<T> RefUnwindSafe for Optional<T>

impl<T> Send for Optional<T>

impl<T> Sync for Optional<T>

impl<T> Unpin for Optional<T>

impl<T> UnsafeUnpin for Optional<T>

impl<T> UnwindSafe for Optional<T>

impl<T> WithSubscriber for Optional<T>

impl<T, Request> Service for Optional<T>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>
fn call(self: &mut Self, request: Request) -> <Self as >::Future

impl<T, Request> ServiceExt for Optional<T>

impl<T, U> Into for Optional<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Optional<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Optional<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::fmt::Debug> Debug for Optional<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result