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) -> Error<K>
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>) -> Error<K>
pub fn with_kind(self, kind: ErrorKind<K>) -> Error<K>
A functional method for setting the error kind
sourcepub fn with_message(self, msg: impl ToString) -> Error<K>
pub fn with_message(self, msg: impl ToString) -> Error<K>
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<Error<K>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Error<K>, <__D as Deserializer<'de>>::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)>
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>) -> Error<K>
fn from(err: TryLockError<T>) -> Error<K>
Converts to this type from the input type.
source§impl<K> Ord for Error<K>where
K: Ord,
impl<K> Ord for Error<K>where
K: Ord,
source§impl<K> PartialEq for Error<K>where
K: PartialEq,
impl<K> PartialEq for Error<K>where
K: PartialEq,
source§impl<K> PartialOrd for Error<K>where
K: PartialOrd,
impl<K> PartialOrd for Error<K>where
K: PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<K> Serialize for Error<K>where
K: Serialize,
impl<K> Serialize for Error<K>where
K: Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<K> Eq for Error<K>where
K: Eq,
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
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.