pub struct Sanitize<'a> { /* private fields */ }Expand description
Customize how an Error is converted to a response.
Implementations§
Source§impl<'a> Sanitize<'a>
impl<'a> Sanitize<'a>
Sourcepub fn with_canonical_reason(self) -> Self
pub fn with_canonical_reason(self) -> Self
Use the canonical reason of the status code as the error message.
Sourcepub fn with_message<T>(self, message: T) -> Self
pub fn with_message<T>(self, message: T) -> Self
Provide a custom message to use for the response generated from this error.
Sourcepub fn with_status_code(self, status: StatusCode) -> Self
pub fn with_status_code(self, status: StatusCode) -> Self
Overrides the HTTP status code of the error.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Sanitize<'a>
impl<'a> !RefUnwindSafe for Sanitize<'a>
impl<'a> Send for Sanitize<'a>
impl<'a> Sync for Sanitize<'a>
impl<'a> Unpin for Sanitize<'a>
impl<'a> !UnwindSafe for Sanitize<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more