Struct warp::reject::Rejection

source ·
pub struct Rejection {
    reason: Reason,
}
Expand description

Rejection of a request by a Filter.

See the reject documentation for more.

Fields§

§reason: Reason

Implementations§

source§

impl Rejection

source

fn known(known: Known) -> Self

source

fn custom(other: Box<dyn Cause>) -> Self

source

pub fn find<T: 'static>(&self) -> Option<&T>

Searches this Rejection for a specific cause.

A Rejection will accumulate causes over a Filter chain. This method can search through them and return the first cause of this type.

§Example
#[derive(Debug)]
struct Nope;

impl warp::reject::Reject for Nope {}

let reject = warp::reject::custom(Nope);

if let Some(nope) = reject.find::<Nope>() {
   println!("found it: {:?}", nope);
}
source

pub fn is_not_found(&self) -> bool

Returns true if this Rejection was made via warp::reject::not_found.

§Example
let rejection = warp::reject();

assert!(rejection.is_not_found());

Trait Implementations§

source§

impl CombineRejection<Infallible> for Rejection

§

type One = Rejection

The type that should be returned when only 1 of the two “rejections” occurs. Read more
§

type Combined = Infallible

The type that should be returned when both rejections occur, and need to be combined.
source§

fn combine(self, other: Infallible) -> Self::Combined

source§

impl CombineRejection<Rejection> for Infallible

§

type One = Rejection

The type that should be returned when only 1 of the two “rejections” occurs. Read more
§

type Combined = Infallible

The type that should be returned when both rejections occur, and need to be combined.
source§

fn combine(self, _: Rejection) -> Self::Combined

source§

impl CombineRejection<Rejection> for Rejection

§

type One = Rejection

The type that should be returned when only 1 of the two “rejections” occurs. Read more
§

type Combined = Rejection

The type that should be returned when both rejections occur, and need to be combined.
source§

fn combine(self, other: Rejection) -> Self::Combined

source§

impl Debug for Rejection

source§

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

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

impl From<Infallible> for Rejection

source§

fn from(infallible: Infallible) -> Rejection

Converts to this type from the input type.
source§

impl<T: Reject> From<T> for Rejection

source§

fn from(err: T) -> Rejection

Converts to this type from the input type.
source§

impl<F, R> Func<Rejection> for F
where F: Fn(Rejection) -> R,

§

type Output = R

source§

fn call(&self, arg: Rejection) -> Self::Output

source§

impl IsReject for Rejection

Auto Trait Implementations§

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<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<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<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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<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