Skip to main content

And

Struct And 

Source
pub struct And<L, R> { /* private fields */ }
Expand description

Requires both predicates to return Cacheable.

Short-circuits: if the left predicate returns NonCacheable, the right predicate is not evaluated.

Implementations§

Source§

impl<L, R> And<L, R>

Source

pub fn new(left: L, right: R) -> And<L, R>

Creates a new And combinator from two predicates.

Trait Implementations§

Source§

impl<L, R> Debug for And<L, R>
where L: Debug, R: Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<L, R> Predicate for And<L, R>
where L: Predicate + Send + Sync, R: Predicate<Subject = <L as Predicate>::Subject> + Send + Sync, <L as Predicate>::Subject: Send,

Source§

type Subject = <L as Predicate>::Subject

The type being evaluated by this predicate.
Source§

fn check<'life0, 'async_trait>( &'life0 self, subject: <And<L, R> as Predicate>::Subject, ) -> Pin<Box<dyn Future<Output = PredicateResult<<And<L, R> as Predicate>::Subject>> + Send + 'async_trait>>
where 'life0: 'async_trait, And<L, R>: 'async_trait,

Evaluate whether the subject should be cached. Read more

Auto Trait Implementations§

§

impl<L, R> Freeze for And<L, R>
where L: Freeze, R: Freeze,

§

impl<L, R> RefUnwindSafe for And<L, R>

§

impl<L, R> Send for And<L, R>
where L: Send, R: Send,

§

impl<L, R> Sync for And<L, R>
where L: Sync, R: Sync,

§

impl<L, R> Unpin for And<L, R>
where L: Unpin, R: Unpin,

§

impl<L, R> UnwindSafe for And<L, R>
where L: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<P> BodyPredicate for P
where P: Predicate,

Source§

fn body(self, operation: Operation) -> Body<P>

Adds a body matching operation to this predicate chain.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<P> HeaderPredicate for P
where P: Predicate,

Source§

fn header(self, operation: Operation) -> Header<P>

Adds a header matching operation to this predicate chain.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<P> MethodPredicate for P
where P: Predicate,

Source§

fn method(self, method: Method) -> Method<P>

Adds an HTTP method match to this predicate chain.
Source§

impl<P> PathPredicate for P
where P: Predicate,

Source§

fn path(self, resource: String) -> Path<P>

Adds a path pattern match to this predicate chain. Read more
Source§

impl<T> PredicateExt for T
where T: Predicate,

Source§

fn and<R>(self, right: R) -> And<Self, R>
where R: Predicate<Subject = Self::Subject>,

Combines this predicate with another using AND logic. Read more
Source§

fn or<R>(self, right: R) -> Or<Self, R>
where R: Predicate<Subject = Self::Subject>,

Combines this predicate with another using OR logic. Read more
Source§

fn not(self) -> Not<Self>

Inverts this predicate’s result. Read more
Source§

fn boxed(self) -> Box<dyn Predicate<Subject = Self::Subject> + Sync + Send>
where Self: Send + Sync + 'static,

Boxes this predicate into a trait object. Read more
Source§

impl<P> QueryPredicate for P
where P: Predicate,

Source§

fn query(self, operation: Operation) -> Query<P>

Adds a query parameter match to this predicate chain.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<P> StatusCodePredicate for P
where P: Predicate,

Source§

fn status_code(self, status_code: StatusCode) -> StatusCode<P>

Matches an exact status code.
Source§

fn status_code_in(self, codes: Vec<StatusCode>) -> StatusCode<P>

Matches any of the specified status codes.
Source§

fn status_code_range(self, start: StatusCode, end: StatusCode) -> StatusCode<P>

Matches status codes within a range (inclusive).
Source§

fn status_code_class(self, class: StatusClass) -> StatusCode<P>

Matches all status codes in a class (e.g., all 2xx).
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<P> VersionPredicate for P
where P: Predicate,

Source§

fn version(self, operation: Operation) -> HttpVersion<P>

Adds a version match to this predicate chain.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more