pub struct SourceError { /* private fields */ }
Expand description
Struct that wraps errors from Source
.
Implementations§
Source§impl SourceError
impl SourceError
Sourcepub const fn by_reason(reason: SourceErrorReason) -> Self
pub const fn by_reason(reason: SourceErrorReason) -> Self
Constructs SourceError
by choosing a reason.
§Examples
let err = SourceError::by_reason(SourceErrorReason::Open);
assert_eq!(
format!("{}", err),
"error occurred while reading <unknown>. reason: cannot open file."
);
Sourcepub const fn from_unknown() -> Self
pub const fn from_unknown() -> Self
Constructs SourceError
with unknown (hidden) reason.
§Examples
let err = SourceError::from_unknown();
assert_eq!(
format!("{}", err),
"error occurred while reading <unknown>. reason: unknown I/O error."
);
Sourcepub fn from_io_error<E: Error + 'static>(e: E) -> Self
pub fn from_io_error<E: Error + 'static>(e: E) -> Self
Trait Implementations§
Source§impl Clone for SourceError
impl Clone for SourceError
Source§fn clone(&self) -> SourceError
fn clone(&self) -> SourceError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SourceError
impl Debug for SourceError
Source§impl Display for SourceError
impl Display for SourceError
Source§impl Error for SourceError
impl Error for SourceError
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 From<SourceError> for EncodeError
impl From<SourceError> for EncodeError
Source§fn from(e: SourceError) -> Self
fn from(e: SourceError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SourceError
impl !RefUnwindSafe for SourceError
impl !Send for SourceError
impl !Sync for SourceError
impl Unpin for SourceError
impl !UnwindSafe for SourceError
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