pub struct Rejection {
reason: Reason,
}
Fields§
§reason: Reason
Implementations§
source§impl Rejection
impl Rejection
fn known(known: Known) -> Self
fn custom(other: Box<dyn Cause>) -> Self
sourcepub fn find<T: 'static>(&self) -> Option<&T>
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);
}
sourcepub fn is_not_found(&self) -> bool
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
impl CombineRejection<Infallible> for Rejection
source§impl CombineRejection<Rejection> for Infallible
impl CombineRejection<Rejection> for Infallible
source§impl CombineRejection<Rejection> for Rejection
impl CombineRejection<Rejection> for Rejection
source§impl From<Infallible> for Rejection
impl From<Infallible> for Rejection
source§fn from(infallible: Infallible) -> Rejection
fn from(infallible: Infallible) -> Rejection
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Rejection
impl !RefUnwindSafe for Rejection
impl Send for Rejection
impl Sync for Rejection
impl Unpin for Rejection
impl !UnwindSafe for Rejection
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