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>
pub fn map_error<T, F>(self, f: F) -> 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)>
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<E: PartialEq> PartialEq for FatalError<E>
impl<E: PartialEq> PartialEq for FatalError<E>
impl<E: Eq> Eq for FatalError<E>
impl<E> StructuralPartialEq for FatalError<E>
Auto Trait Implementations§
impl<E> Freeze for FatalError<E>where
E: Freeze,
impl<E> RefUnwindSafe for FatalError<E>where
E: RefUnwindSafe,
impl<E> Send for FatalError<E>where
E: Send,
impl<E> Sync for FatalError<E>where
E: Sync,
impl<E> Unpin for FatalError<E>where
E: Unpin,
impl<E> UnwindSafe for FatalError<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