pub struct Error { /* private fields */ }Expand description
A universal error type which contains a source and a kind.
An error is either associated with the client or the server.
Implementations
sourceimpl Error
impl Error
sourcepub fn new<K, E>(kind: K, error: E) -> Selfwhere
K: Into<ErrorKind>,
E: Into<Box<dyn ErrorTrait + Send + Sync>>,
pub fn new<K, E>(kind: K, error: E) -> Selfwhere
K: Into<ErrorKind>,
E: Into<Box<dyn ErrorTrait + Send + Sync>>,
Creates a new error.
sourcepub fn empty<K>(kind: K) -> Selfwhere
K: Into<ErrorKind>,
pub fn empty<K>(kind: K) -> Selfwhere
K: Into<ErrorKind>,
Creates a new error without a source.
sourcepub fn status_code(&self) -> StatusCode
pub fn status_code(&self) -> StatusCode
Returns the StatusCode corresponding to the ErrorKind.
sourcepub fn from_client_io(error: Error) -> Self
pub fn from_client_io(error: Error) -> Self
Returns a new error from an io::Error originating from the client.
sourcepub fn from_server_error<E>(error: E) -> Selfwhere
E: Into<Box<dyn ErrorTrait + Send + Sync>>,
pub fn from_server_error<E>(error: E) -> Selfwhere
E: Into<Box<dyn ErrorTrait + Send + Sync>>,
Returns a new error originating from the server.
Trait Implementations
sourceimpl Error for Error
impl Error for Error
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
sourceimpl From<DeserializeError> for Error
impl From<DeserializeError> for Error
sourcefn from(e: DeserializeError) -> Self
fn from(e: DeserializeError) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more