[−][src]Struct embedded_error_chain::Error
An error that consists of an ErrorCode
that belongs to an ErrorCategory
and
optionally up to 4
chained error codes of different types that implement
ErrorCategory
.
Implementations
impl<C> Error<C>
[src]
pub const fn new_raw(error_code: ErrorCode) -> Error<C>
[src]
Create a new Error
with an empty chain from the supplied raw error_code
.
impl<C> Error<C>
[src]
pub const fn chain_capacity(&self) -> usize
[src]
Get the capacity of the error chain.
Always returns ERROR_CHAIN_LEN
.
impl<C: ErrorCategory> Error<C>
[src]
pub fn new(error_code: C) -> Error<C>
[src]
Create a new Error
with an empty chain from the supplied error_code
.
pub fn code(&self) -> C
[src]
Get the error code of the latest error.
pub fn chain_len(&self) -> usize
[src]
Get the length of the error chain.
pub fn caused_by<T: ErrorCategory>(&self, error_code: T) -> bool
[src]
Query if this error was caused by error_code
which belongs to the error category
T
.
pub fn code_of_category<T: ErrorCategory>(&self) -> Option<T>
[src]
Query the error code contained in this error that belongs to the ErrorCategory
T
. Return None
if this error was not caused by the specified error category.
pub fn iter(&self) -> ErrorIterⓘ
[src]
Create an iterator that iterates over all error codes in this error.
Trait Implementations
impl<C: ErrorCategory> ChainError<<C as ErrorCategory>::L0, C, (L0, Error_t)> for Error<C::L0>
[src]
impl<C: ErrorCategory> ChainError<<C as ErrorCategory>::L1, C, (L1, Error_t)> for Error<C::L1>
[src]
impl<C: ErrorCategory> ChainError<<C as ErrorCategory>::L2, C, (L2, Error_t)> for Error<C::L2>
[src]
impl<C: ErrorCategory> ChainError<<C as ErrorCategory>::L3, C, (L3, Error_t)> for Error<C::L3>
[src]
impl<C: ErrorCategory> ChainError<<C as ErrorCategory>::L4, C, (L4, Error_t)> for Error<C::L4>
[src]
impl<C: ErrorCategory> ChainError<<C as ErrorCategory>::L5, C, (L5, Error_t)> for Error<C::L5>
[src]
impl<C: ErrorCategory> Clone for Error<C>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
[src]
impl<C: ErrorCategory> Copy for Error<C>
[src]
impl<C: ErrorCategory> Debug for Error<C>
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]
Debug format this error and its chain.
Error message example:
ControlTaskError(0): init failed
- ICM20689Error(0): init failed
- SpiError(0): bus error
impl<C: ErrorCategory> Eq for Error<C>
[src]
impl<C: ErrorCategory> From<C> for Error<C>
[src]
impl<C: ErrorCategory> PartialEq<Error<C>> for Error<C>
[src]
Auto Trait Implementations
impl<C> Send for Error<C> where
C: Send,
C: Send,
impl<C> Sync for Error<C> where
C: Sync,
C: Sync,
impl<C> Unpin for Error<C> where
C: Unpin,
C: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,