pub enum Result<T, RE, FE> {
Ok(T),
Recoverable(RE),
Fatal(FE),
}
Variants§
Implementations§
Source§impl<T, RE, FE> Result<T, RE, FE>
impl<T, RE, FE> Result<T, RE, FE>
pub fn from_std(value: StdResult<StdResult<T, RE>, FE>) -> Self
pub fn from_split<E>( split: impl FnOnce(E) -> StdResult<RE, FE>, value: StdResult<T, E>, ) -> Self
pub fn ok_or_recoverable(value: StdResult<T, RE>) -> Self
pub fn ok_or_fatal(value: StdResult<T, FE>) -> Self
pub fn from_err(error: StdResult<RE, FE>) -> Self
pub fn to_std(self) -> StdResult<StdResult<T, RE>, FE>
pub fn to_std_flipped(self) -> StdResult<T, StdResult<RE, FE>>
pub const fn is_ok(&self) -> bool
pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool
pub const fn is_any_err(&self) -> bool
pub const fn is_recoverable(&self) -> bool
pub fn is_recoverable_and(self, f: impl FnOnce(RE) -> bool) -> bool
pub const fn is_fatal(&self) -> bool
pub fn is_fatal_and(self, f: impl FnOnce(FE) -> bool) -> bool
pub fn ok(self) -> Option<T>
pub fn recoverable(self) -> Option<RE>
pub fn fatal(self) -> Option<FE>
pub fn non_fatal(self) -> Option<StdResult<T, RE>>
pub fn err(self) -> Option<StdResult<RE, FE>>
pub fn as_ref(&self) -> Result<&T, &RE, &FE>
pub fn as_mut(&mut self) -> Result<&mut T, &mut RE, &mut FE>
pub fn map<O>(self, f: impl FnOnce(T) -> O) -> Result<O, RE, FE>
pub fn map_or<O>(self, default: O, f: impl FnOnce(T) -> O) -> O
pub fn map_or_else<O>( self, default: impl FnOnce() -> O, f: impl FnOnce(T) -> O, ) -> O
pub fn map_recoverable<REO>( self, f: impl FnOnce(RE) -> REO, ) -> Result<T, REO, FE>
pub fn map_fatal<FEO>(self, f: impl FnOnce(FE) -> FEO) -> Result<T, RE, FEO>
pub fn inspect(self, f: impl FnOnce(&T)) -> Self
pub fn inspect_recoverable(self, f: impl FnOnce(&RE)) -> Self
pub fn inspect_fatal(self, f: impl FnOnce(&FE)) -> Self
pub fn as_deref(&self) -> Result<&T::Target, &RE, &FE>where
T: Deref,
pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut RE, &mut FE>where
T: DerefMut,
pub fn iter(&self) -> IntoIter<&T>
pub fn iter_mut(&mut self) -> IntoIter<&mut T>
pub fn expect_nonfatal(self, msg: &str) -> LocalResult<T, RE>where
FE: Debug,
pub fn expect_ok(self, msg: &str) -> T
pub fn unwrap_nonfatal(self) -> LocalResult<T, RE>where
FE: Debug,
pub fn unwrap_ok(self) -> T
pub fn unwrap_or_default(self) -> Twhere
T: Default,
pub fn unwrap_or(self, default: T) -> T
pub fn unwrap_or_else(self, default: impl FnOnce() -> T) -> T
pub fn and<O>(self, res: Result<O, RE, FE>) -> Result<O, RE, FE>
pub fn and_then<O>( self, f: impl FnOnce(T) -> Result<O, RE, FE>, ) -> Result<O, RE, FE>
pub fn flatten_err<E: From<RE> + From<FE>>(self) -> StdResult<T, E>
pub fn convert_err<REO: From<RE>, FEO: From<FE>>(self) -> Result<T, REO, FEO>
pub fn more_fatal<REO>( self, f: impl FnOnce(RE) -> StdResult<REO, FE>, ) -> Result<T, REO, FE>
pub fn less_fatal<FEO>( self, f: impl FnOnce(FE) -> StdResult<RE, FEO>, ) -> Result<T, RE, FEO>
pub fn collect_layered<U>(
iter: impl IntoIterator<Item = Result<U, RE, FE>>,
) -> Selfwhere
T: FromIterator<U>,
Trait Implementations§
Source§impl<T, RE, FE> From<LocalResult<T, RE>> for Result<T, RE, FE>
impl<T, RE, FE> From<LocalResult<T, RE>> for Result<T, RE, FE>
Source§fn from(value: LocalResult<T, RE>) -> Self
fn from(value: LocalResult<T, RE>) -> Self
Converts to this type from the input type.
Source§impl<T, RE, FE, C, EC> FromIterator<Result<T, RE, FE>> for CollectedErrs<StdResult<C, EC>>
impl<T, RE, FE, C, EC> FromIterator<Result<T, RE, FE>> for CollectedErrs<StdResult<C, EC>>
Source§impl<T, RE, FE, C, REC, FEC> FromIterator<Result<T, RE, FE>> for CollectedErrs<Result<C, REC, FEC>>
impl<T, RE, FE, C, REC, FEC> FromIterator<Result<T, RE, FE>> for CollectedErrs<Result<C, REC, FEC>>
Source§impl<T, RE, FE, C, REC> FromIterator<Result<T, RE, FE>> for CollectedRecoverables<Result<C, REC, FE>>where
C: FromIterator<T>,
REC: FromIterator<RE>,
impl<T, RE, FE, C, REC> FromIterator<Result<T, RE, FE>> for CollectedRecoverables<Result<C, REC, FE>>where
C: FromIterator<T>,
REC: FromIterator<RE>,
Source§impl<T, RE, FE, C> FromIterator<Result<T, RE, FE>> for Result<C, RE, FE>where
C: FromIterator<T>,
impl<T, RE, FE, C> FromIterator<Result<T, RE, FE>> for Result<C, RE, FE>where
C: FromIterator<T>,
Source§impl<T, RE, FE, REO: From<RE>> FromResidual<LocalResult<Infallible, RE>> for Result<T, REO, FE>
impl<T, RE, FE, REO: From<RE>> FromResidual<LocalResult<Infallible, RE>> for Result<T, REO, FE>
Source§fn from_residual(residual: LocalResult<Infallible, RE>) -> Self
fn from_residual(residual: LocalResult<Infallible, RE>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moreSource§impl<T, FE, REO, FEO: From<FE>> FromResidual<Result<Infallible, FE>> for Result<T, REO, FEO>
impl<T, FE, REO, FEO: From<FE>> FromResidual<Result<Infallible, FE>> for Result<T, REO, FEO>
Source§fn from_residual(residual: StdResult<Infallible, FE>) -> Self
fn from_residual(residual: StdResult<Infallible, FE>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moreSource§impl<T, FE, FEO: From<FE>> FromResidual<Result<Infallible, Infallible, FE>> for StdResult<T, FEO>
impl<T, FE, FEO: From<FE>> FromResidual<Result<Infallible, Infallible, FE>> for StdResult<T, FEO>
Source§fn from_residual(residual: Result<Infallible, Infallible, FE>) -> Self
fn from_residual(residual: Result<Infallible, Infallible, FE>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moreSource§impl<T, RE, FE, FEO: From<FE>> FromResidual<Result<Infallible, Infallible, FE>> for Result<T, RE, FEO>
impl<T, RE, FE, FEO: From<FE>> FromResidual<Result<Infallible, Infallible, FE>> for Result<T, RE, FEO>
Source§fn from_residual(residual: Result<Infallible, Infallible, FE>) -> Self
fn from_residual(residual: Result<Infallible, Infallible, FE>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moreSource§impl<'a, T, RE, FE> IntoIterator for &'a Result<T, RE, FE>
impl<'a, T, RE, FE> IntoIterator for &'a Result<T, RE, FE>
Source§impl<'a, T, RE, FE> IntoIterator for &'a mut Result<T, RE, FE>
impl<'a, T, RE, FE> IntoIterator for &'a mut Result<T, RE, FE>
Source§impl<T, RE, FE> IntoIterator for Result<T, RE, FE>
impl<T, RE, FE> IntoIterator for Result<T, RE, FE>
Source§impl<T: Ord, RE: Ord, FE: Ord> Ord for Result<T, RE, FE>
impl<T: Ord, RE: Ord, FE: Ord> Ord for Result<T, RE, FE>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd, RE: PartialOrd, FE: PartialOrd> PartialOrd for Result<T, RE, FE>
impl<T: PartialOrd, RE: PartialOrd, FE: PartialOrd> PartialOrd for Result<T, RE, FE>
Source§impl<T, RE, FE> Try for Result<T, RE, FE>
impl<T, RE, FE> Try for Result<T, RE, FE>
Source§type Output = LocalResult<T, RE>
type Output = LocalResult<T, RE>
🔬This is a nightly-only experimental API. (
try_trait_v2
)The type of the value produced by
?
when not short-circuiting.Source§type Residual = Result<Infallible, Infallible, FE>
type Residual = Result<Infallible, Infallible, FE>
🔬This is a nightly-only experimental API. (
try_trait_v2
)The type of the value passed to
FromResidual::from_residual
as part of ?
when short-circuiting. Read moreSource§fn from_output(output: Self::Output) -> Self
fn from_output(output: Self::Output) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from its
Output
type. Read moreSource§fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
🔬This is a nightly-only experimental API. (
try_trait_v2
)Used in
?
to decide whether the operator should produce a value
(because this returned ControlFlow::Continue
)
or propagate a value back to the caller
(because this returned ControlFlow::Break
). Read moreimpl<T: Copy, RE: Copy, FE: Copy> Copy for Result<T, RE, FE>
impl<T: Eq, RE: Eq, FE: Eq> Eq for Result<T, RE, FE>
impl<T, RE, FE> StructuralPartialEq for Result<T, RE, FE>
Auto Trait Implementations§
impl<T, RE, FE> Freeze for Result<T, RE, FE>
impl<T, RE, FE> RefUnwindSafe for Result<T, RE, FE>
impl<T, RE, FE> Send for Result<T, RE, FE>
impl<T, RE, FE> Sync for Result<T, RE, FE>
impl<T, RE, FE> Unpin for Result<T, RE, FE>
impl<T, RE, FE> UnwindSafe for Result<T, RE, FE>
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