Struct warp::filters::BoxedFilter
source · pub struct BoxedFilter<T: Tuple> {
filter: Arc<dyn Filter<Extract = T, Error = Rejection, Future = Pin<Box<dyn Future<Output = Result<T, Rejection>> + Send>>> + Send + Sync>,
}
Expand description
A type representing a boxed Filter
trait object.
The filter inside is a dynamic trait object. The purpose of this type is
to ease returning Filter
s from other functions.
To create one, call Filter::boxed
on any filter.
§Examples
use warp::{Filter, filters::BoxedFilter, Reply};
pub fn assets_filter() -> BoxedFilter<(impl Reply,)> {
warp::path("assets")
.and(warp::fs::dir("./assets"))
.boxed()
}
Fields§
§filter: Arc<dyn Filter<Extract = T, Error = Rejection, Future = Pin<Box<dyn Future<Output = Result<T, Rejection>> + Send>>> + Send + Sync>
Implementations§
Trait Implementations§
source§impl<T: Tuple> Clone for BoxedFilter<T>
impl<T: Tuple> Clone for BoxedFilter<T>
source§fn clone(&self) -> BoxedFilter<T>
fn clone(&self) -> BoxedFilter<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Tuple> Debug for BoxedFilter<T>
impl<T: Tuple> Debug for BoxedFilter<T>
source§impl<T: Tuple + Send> FilterBase for BoxedFilter<T>
impl<T: Tuple + Send> FilterBase for BoxedFilter<T>
Auto Trait Implementations§
impl<T> Freeze for BoxedFilter<T>
impl<T> !RefUnwindSafe for BoxedFilter<T>
impl<T> Send for BoxedFilter<T>
impl<T> Sync for BoxedFilter<T>
impl<T> Unpin for BoxedFilter<T>
impl<T> !UnwindSafe for BoxedFilter<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Filter for Twhere
T: FilterBase,
impl<T> Filter for Twhere
T: FilterBase,
source§fn and<F>(self, other: F) -> And<Self, F>
fn and<F>(self, other: F) -> And<Self, F>
Composes a new
Filter
that requires both this and the other to filter a request. Read moresource§fn or<F>(self, other: F) -> Or<Self, F>
fn or<F>(self, other: F) -> Or<Self, F>
Composes a new
Filter
of either this or the other filter. Read moresource§fn map<F>(self, fun: F) -> Map<Self, F>
fn map<F>(self, fun: F) -> Map<Self, F>
Composes this
Filter
with a function receiving the extracted value. Read moresource§fn then<F>(self, fun: F) -> Then<Self, F>
fn then<F>(self, fun: F) -> Then<Self, F>
Composes this
Filter
with an async function receiving
the extracted value. Read moresource§fn and_then<F>(self, fun: F) -> AndThen<Self, F>
fn and_then<F>(self, fun: F) -> AndThen<Self, F>
Composes this
Filter
with a fallible async function receiving
the extracted value. Read moresource§fn or_else<F>(self, fun: F) -> OrElse<Self, F>
fn or_else<F>(self, fun: F) -> OrElse<Self, F>
Compose this
Filter
with a function receiving an error. Read moresource§fn recover<F>(self, fun: F) -> Recover<Self, F>
fn recover<F>(self, fun: F) -> Recover<Self, F>
Compose this
Filter
with a function receiving an error and
returning a new type, instead of the same type. Read moresource§fn untuple_one<T>(self) -> UntupleOne<Self>
fn untuple_one<T>(self) -> UntupleOne<Self>
Convenience method to remove one layer of tupling. Read more