Enum fatal_error::FatalError
source · pub enum FatalError<E> {
Error(E),
Fatal(E),
}
Expand description
Error type
Variants§
Implementations§
source§impl<E> FatalError<E>
impl<E> FatalError<E>
sourcepub fn into_inner(self) -> E
pub fn into_inner(self) -> E
transforms the error into it’s inner type
sourcepub fn map<E2, F>(self, f: F) -> FatalError<E2>where
F: FnOnce(E) -> E2,
pub fn map<E2, F>(self, f: F) -> FatalError<E2>where F: FnOnce(E) -> E2,
applies f to the inner error preserving the FatalError::Error
or FatalError::Fatal
state
sourcepub fn deescalate(self) -> Self
pub fn deescalate(self) -> Self
Makes this error non fatal
sourcepub fn fatality(self) -> Result<E, Self>
pub fn fatality(self) -> Result<E, Self>
Return Ok(E)
if the error is non fatal else Err(Self)
is returned
sourcepub fn recover(self) -> Result<E, E>
pub fn recover(self) -> Result<E, E>
return Err(E)
if the error is fatal otherwise Ok(E)
is returned
sourcepub fn map_error<T, F>(self, f: F) -> Result<T, Self>where
F: FnOnce(E) -> Result<T, Self>,
pub fn map_error<T, F>(self, f: F) -> Result<T, Self>where F: FnOnce(E) -> Result<T, Self>,
recover a non fatal error with the given closure
Trait Implementations§
source§impl<E: Clone> Clone for FatalError<E>
impl<E: Clone> Clone for FatalError<E>
source§fn clone(&self) -> FatalError<E>
fn clone(&self) -> FatalError<E>
Returns a copy 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<E: Debug> Debug for FatalError<E>
impl<E: Debug> Debug for FatalError<E>
source§impl<E: Display> Display for FatalError<E>
impl<E: Display> Display for FatalError<E>
source§impl<E: StdError + 'static> Error for FatalError<E>
impl<E: StdError + 'static> Error for FatalError<E>
source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + '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<E: PartialEq> PartialEq<FatalError<E>> for FatalError<E>
impl<E: PartialEq> PartialEq<FatalError<E>> for FatalError<E>
source§fn eq(&self, other: &FatalError<E>) -> bool
fn eq(&self, other: &FatalError<E>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.