#[non_exhaustive]pub enum Error<E = ErrorKind> {
Source(E),
Context {
kind: ErrorKind,
message: Option<&'static str>,
},
}Expand description
An error produced either by an underlying I/O object or by a Hadris helper.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Source(E)
Error returned by the underlying reader, writer, or seeker.
Context
Error synthesized by Hadris, with optional allocation-free context.
Implementations§
Source§impl<E> Error<E>
impl<E> Error<E>
Sourcepub const fn from_source(source: E) -> Self
pub const fn from_source(source: E) -> Self
Wrap an error returned by the underlying I/O object.
Sourcepub const fn from_kind(kind: ErrorKind) -> Self
pub const fn from_kind(kind: ErrorKind) -> Self
Construct a Hadris-generated error without additional context.
Sourcepub const fn new(kind: ErrorKind, message: &'static str) -> Self
pub const fn new(kind: ErrorKind, message: &'static str) -> Self
Construct a Hadris-generated error with static context.
Sourcepub const fn other(message: &'static str) -> Self
pub const fn other(message: &'static str) -> Self
Construct an Other error with static context.
Sourcepub const fn source_ref(&self) -> Option<&E>
pub const fn source_ref(&self) -> Option<&E>
Borrow the underlying source, if present.
Sourcepub fn into_source(self) -> Option<E>
pub fn into_source(self) -> Option<E>
Consume the error and return its underlying source, if present.
Trait Implementations§
impl<E: Eq> Eq for Error<E>
Source§impl<E: Error> Error for Error<E>
impl<E: Error> Error for Error<E>
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()
impl<E: PartialEq> StructuralPartialEq for Error<E>
Auto Trait Implementations§
impl<E> Freeze for Error<E>where
E: Freeze,
impl<E> RefUnwindSafe for Error<E>where
E: RefUnwindSafe,
impl<E> Send for Error<E>where
E: Send,
impl<E> Sync for Error<E>where
E: Sync,
impl<E> Unpin for Error<E>where
E: Unpin,
impl<E> UnsafeUnpin for Error<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for Error<E>where
E: 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