pub struct Error { /* private fields */ }
Expand description
Error object.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(kind: &str, title: &str, status: StatusCode) -> Self
pub fn new(kind: &str, title: &str, status: StatusCode) -> Self
Create an error object.
Sourcepub fn set_kind(&mut self, kind: &str, title: &str) -> &mut Self
pub fn set_kind(&mut self, kind: &str, title: &str) -> &mut Self
Set kind and title of the error.
Sourcepub fn set_status_code(&mut self, value: StatusCode) -> &mut Self
pub fn set_status_code(&mut self, value: StatusCode) -> &mut Self
Set a status code information about the error.
Sourcepub fn status_code(&self) -> StatusCode
pub fn status_code(&self) -> StatusCode
Return a status code for this error.
Sourcepub fn set_detail(&mut self, value: &str) -> &mut Self
pub fn set_detail(&mut self, value: &str) -> &mut Self
Set detailed information about the error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<StatusCode> for Error
impl From<StatusCode> for Error
Source§fn from(status: StatusCode) -> Self
fn from(status: StatusCode) -> Self
Converts to this type from the input type.
Source§impl ProblemDetailsMut for Error
impl ProblemDetailsMut for Error
Source§fn set_status_code(&mut self, value: StatusCode) -> &mut Self
fn set_status_code(&mut self, value: StatusCode) -> &mut Self
Set a status code.
Source§fn set_detail(&mut self, detail: &str) -> &mut Self
fn set_detail(&mut self, detail: &str) -> &mut Self
Set a detail.
Source§impl ProblemDetailsReadOnly for Error
impl ProblemDetailsReadOnly for Error
Source§fn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
Return the HTTP status code generated by the origin server for this
occurrence of the problem.
Source§fn kind(&self) -> &str
fn kind(&self) -> &str
Return a URI reference RFC3986 that identifies the
problem type. This specification encourages that, when
dereferenced, it provide human-readable documentation for the
problem type. When this member is not present, its value is assumed
to be “about:blank”.
Source§fn title(&self) -> &str
fn title(&self) -> &str
Return a short, human-readable summary of the problem
type. It SHOULD NOT change from occurrence to occurrence of the
problem, except for purposes of localization
impl ProblemDetails for Error
Getters for Problem Details and accompanying metadata
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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