Struct AsyncFilter
pub struct AsyncFilter<T, U> { /* private fields */ }
Conditionally dispatch requests to the inner service based on an asynchronous predicate.
Implementations
impl<T, U> AsyncFilter<T, U>
const fn new(inner: T, predicate: U) -> SelfReturns a new
AsyncFilterservice wrappinginner.fn layer(predicate: U) -> FilterLayer<U>Returns a new
Layerthat wraps services with anAsyncFilterservice with the givenAsyncPredicate.async fn check<R>(&mut self, request: R) -> Result<U::Request, BoxError> where U: AsyncPredicate<R>,Check a
Requestvalue against this filter's predicate.fn get_ref(&self) -> &TGet a reference to the inner service
fn get_mut(&mut self) -> &mut TGet a mutable reference to the inner service
fn into_inner(self) -> TConsume
self, returning the inner service
Trait Implementations
impl<T, U, Request> Service<Request> for AsyncFilter<T, U>
where
U: AsyncPredicate<Request>,
T: Service<U::Request> + Clone,
T::Error: Into<BoxError>,
type Response = <T as Service<<U as AsyncPredicate<Request>>::Request>>::Response;type Error = Box<dyn Error + Sync + Send>;type Future = AsyncResponseFuture<U, T, Request>;fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn call(&mut self, request: Request) -> Self::Future
impl<T: Clone, U: Clone> Clone for AsyncFilter<T, U>
fn clone(&self) -> AsyncFilter<T, U>
impl<T: Debug, U: Debug> Debug for AsyncFilter<T, U>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<T, U> Freeze for AsyncFilter<T, U>
where
T: Freeze,
U: Freeze,
impl<T, U> RefUnwindSafe for AsyncFilter<T, U>
where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for AsyncFilter<T, U>
where
T: Send,
U: Send,
impl<T, U> Sync for AsyncFilter<T, U>
where
T: Sync,
U: Sync,
impl<T, U> Unpin for AsyncFilter<T, U>
where
T: Unpin,
U: Unpin,
impl<T, U> UnsafeUnpin for AsyncFilter<T, U>
where
T: UnsafeUnpin,
U: UnsafeUnpin,
impl<T, U> UnwindSafe for AsyncFilter<T, U>
where
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<C, Target> MakeConnection<Target> for AsyncFilter<T, U>
where
C: Service<Target>,
<C as Service<Target>>::Response: AsyncRead + AsyncWrite,
type Connection = <C as Service<Target>>::Response;type Error = <C as Service<Target>>::Error;type Future = <C as Service<Target>>::Future;fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), <C as MakeConnection<Target>>::Error>>fn make_connection(&mut self, target: Target) -> <C as MakeConnection<Target>>::Future
impl<M, S, Target, Request> MakeService<Target, Request> for AsyncFilter<T, U>
where
M: Service<Target, Response = S>,
S: Service<Request>,
type Response = <S as Service<Request>>::Response;type Error = <S as Service<Request>>::Error;type Service = S;type MakeError = <M as Service<Target>>::Error;type Future = <M as Service<Target>>::Future;fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>fn make_service(&mut self, target: Target) -> <M as MakeService<Target, Request>>::Future
impl<T> Any for AsyncFilter<T, U>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for AsyncFilter<T, U>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for AsyncFilter<T, U>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for AsyncFilter<T, U>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for AsyncFilter<T, U>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for AsyncFilter<T, U>
impl<T> ToOwned for AsyncFilter<T, U>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> WithSubscriber for AsyncFilter<T, U>
impl<T, Request> ServiceExt<Request> for AsyncFilter<T, U>
where
T: Service<Request> + ?Sized,
impl<T, U> Into<U> for AsyncFilter<T, U>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for AsyncFilter<T, U>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for AsyncFilter<T, U>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>