Trait AsyncPredicate

Source
pub trait AsyncPredicate<Request> {
    type Request;

    // Required method
    fn check(
        &self,
        request: Request,
    ) -> impl Future<Output = Result<Self::Request, BoxError>>;
}
Available on crate feature filter only.
Expand description

Checks a request asynchronously.

Required Associated Types§

Source

type Request

The type of requests returned by check.

This request is forwarded to the inner service if the predicate succeeds.

Required Methods§

Source

fn check( &self, request: Request, ) -> impl Future<Output = Result<Self::Request, BoxError>>

Check whether the given request should be forwarded.

If the future resolves with Ok, the request is forwarded to the inner service.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F, T, U, R, E> AsyncPredicate<T> for F
where F: Fn(T) -> U, U: Future<Output = Result<R, E>>, E: Into<BoxError>,