#[non_exhaustive]pub struct ErrorHandler {
pub error_code: ErrorCode,
pub static_file: String,
pub mime_type: String,
/* private fields */
}
Expand description
Custom static error page to be served when an error occurs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.error_code: ErrorCode
Error condition this handler applies to.
static_file: String
Static file content to be served for this error.
mime_type: String
MIME type of file. Defaults to text/html
.
Implementations§
Source§impl ErrorHandler
impl ErrorHandler
pub fn new() -> Self
Sourcepub fn set_error_code<T: Into<ErrorCode>>(self, v: T) -> Self
pub fn set_error_code<T: Into<ErrorCode>>(self, v: T) -> Self
Sets the value of error_code.
Sourcepub fn set_static_file<T: Into<String>>(self, v: T) -> Self
pub fn set_static_file<T: Into<String>>(self, v: T) -> Self
Sets the value of static_file.
Sourcepub fn set_mime_type<T: Into<String>>(self, v: T) -> Self
pub fn set_mime_type<T: Into<String>>(self, v: T) -> Self
Sets the value of mime_type.
Trait Implementations§
Source§impl Clone for ErrorHandler
impl Clone for ErrorHandler
Source§fn clone(&self) -> ErrorHandler
fn clone(&self) -> ErrorHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ErrorHandler
impl Debug for ErrorHandler
Source§impl Default for ErrorHandler
impl Default for ErrorHandler
Source§fn default() -> ErrorHandler
fn default() -> ErrorHandler
Returns the “default value” for a type. Read more
Source§impl Message for ErrorHandler
impl Message for ErrorHandler
Source§impl PartialEq for ErrorHandler
impl PartialEq for ErrorHandler
impl StructuralPartialEq for ErrorHandler
Auto Trait Implementations§
impl Freeze for ErrorHandler
impl RefUnwindSafe for ErrorHandler
impl Send for ErrorHandler
impl Sync for ErrorHandler
impl Unpin for ErrorHandler
impl UnwindSafe for ErrorHandler
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