pub struct Rejection { /* fields omitted */ }
Rejection of a request by a Filter
.
See the reject
documentation for more.
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.
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
.
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
.
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.
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static