pub struct Rejection { /* private fields */ }
Expand description
A rejection response type.
Implementations§
Source§impl Rejection
impl Rejection
Sourcepub fn bad_request(validation: Validation) -> Self
pub fn bad_request(validation: Validation) -> Self
Creates a 400 Bad Request
rejection.
Creates a 401 Unauthorized
rejection.
Sourcepub fn method_not_allowed(err: impl Into<Error>) -> Self
pub fn method_not_allowed(err: impl Into<Error>) -> Self
Creates a 405 Method Not Allowed
rejection.
Sourcepub fn internal_server_error(err: impl Into<Error>) -> Self
pub fn internal_server_error(err: impl Into<Error>) -> Self
Creates a 500 Internal Server Error
rejection.
Creates a 503 Service Unavailable
rejection.
Sourcepub fn from_validation_entry(
key: impl Into<SharedString>,
err: impl Into<Error>,
) -> Self
pub fn from_validation_entry( key: impl Into<SharedString>, err: impl Into<Error>, ) -> Self
Creates a new instance with the validation entry.
Sourcepub fn from_error(err: impl Into<Error>) -> Self
pub fn from_error(err: impl Into<Error>) -> Self
Creates a new instance from an error classified by the error message.
Sourcepub fn with_message(message: impl Into<SharedString>) -> Self
pub fn with_message(message: impl Into<SharedString>) -> Self
Creates a new instance with the error message.
Sourcepub fn context<T: RequestContext + ?Sized>(self, ctx: &T) -> Self
pub fn context<T: RequestContext + ?Sized>(self, ctx: &T) -> Self
Provides the request context for the rejection.
Sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Returns the status code as u16
.
Trait Implementations§
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