pub struct Error<K = String> { /* private fields */ }
Implementations§
Source§impl<K> Error<K>
impl<K> Error<K>
pub fn new(kind: ErrorKind<K>, msg: impl ToString) -> Self
Sourcepub fn set_message(&mut self, msg: impl ToString)
pub fn set_message(&mut self, msg: impl ToString)
Set the error message
Sourcepub fn into_message(self) -> String
pub fn into_message(self) -> String
Consume the error and return the message
Sourcepub fn with_kind(self, kind: ErrorKind<K>) -> Self
pub fn with_kind(self, kind: ErrorKind<K>) -> Self
A functional method for setting the error kind
Sourcepub fn with_message(self, msg: impl ToString) -> Self
pub fn with_message(self, msg: impl ToString) -> Self
A functional method for setting the error message
Trait Implementations§
Source§impl<'de, K> Deserialize<'de> for Error<K>where
K: Deserialize<'de>,
impl<'de, K> Deserialize<'de> for Error<K>where
K: Deserialize<'de>,
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<K> Error for Error<K>
impl<K> Error for Error<K>
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<K, T> From<TryLockError<T>> for Error<K>
impl<K, T> From<TryLockError<T>> for Error<K>
Source§fn from(err: TryLockError<T>) -> Self
fn from(err: TryLockError<T>) -> Self
Converts to this type from the input type.
Source§impl<K: Ord> Ord for Error<K>
impl<K: Ord> Ord for Error<K>
Source§impl<K: PartialOrd> PartialOrd for Error<K>
impl<K: PartialOrd> PartialOrd for Error<K>
impl<K: Eq> Eq for Error<K>
impl<K> StructuralPartialEq for Error<K>
Auto Trait Implementations§
impl<K> Freeze for Error<K>where
K: Freeze,
impl<K> RefUnwindSafe for Error<K>where
K: RefUnwindSafe,
impl<K> Send for Error<K>where
K: Send,
impl<K> Sync for Error<K>where
K: Sync,
impl<K> Unpin for Error<K>where
K: Unpin,
impl<K> UnwindSafe for Error<K>where
K: UnwindSafe,
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