Struct warp::reject::Rejection

source ·
pub struct Rejection { /* private fields */ }
Expand description

Rejection of a request by a Filter.

See the reject documentation for more.

Implementations

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
use std::io;

let err = io::Error::new(
    io::ErrorKind::Other,
    "could be any std::error::Error"
);
let reject = warp::reject::custom(err);

if let Some(cause) = reject.find_cause::<io::Error>() {
   println!("found the io::Error: {}", cause);
}

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

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

assert!(rejection.is_not_found());

Returns an optional error cause for this rejection.

If this Rejection is actuall a combination of rejections, then the returned cause is determined by an internal ranking system. If you’d rather handle different causes with different priorities, use find_cause.

Note

The return type will change from &Box<Error> to &Error in v0.2. This method isn’t marked deprecated, however, since most people aren’t actually using the Box part, and so a deprecation warning would just annoy people who didn’t need to make any changes.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.