Enum Result

Source
pub enum Result<T, RE, FE> {
    Ok(T),
    Recoverable(RE),
    Fatal(FE),
}

Variants§

§

Ok(T)

§

Recoverable(RE)

§

Fatal(FE)

Implementations§

Source§

impl<T, RE, FE> Result<T, RE, FE>

Source

pub fn from_std(value: StdResult<StdResult<T, RE>, FE>) -> Self

Source

pub fn from_split<E>( split: impl FnOnce(E) -> StdResult<RE, FE>, value: StdResult<T, E>, ) -> Self

Source

pub fn ok_or_recoverable(value: StdResult<T, RE>) -> Self

Source

pub fn ok_or_fatal(value: StdResult<T, FE>) -> Self

Source

pub fn from_err(error: StdResult<RE, FE>) -> Self

Source

pub fn to_std(self) -> StdResult<StdResult<T, RE>, FE>

Source

pub fn to_std_flipped(self) -> StdResult<T, StdResult<RE, FE>>

Source

pub const fn is_ok(&self) -> bool

Source

pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool

Source

pub const fn is_any_err(&self) -> bool

Source

pub const fn is_recoverable(&self) -> bool

Source

pub fn is_recoverable_and(self, f: impl FnOnce(RE) -> bool) -> bool

Source

pub const fn is_fatal(&self) -> bool

Source

pub fn is_fatal_and(self, f: impl FnOnce(FE) -> bool) -> bool

Source

pub fn ok(self) -> Option<T>

Source

pub fn recoverable(self) -> Option<RE>

Source

pub fn fatal(self) -> Option<FE>

Source

pub fn non_fatal(self) -> Option<StdResult<T, RE>>

Source

pub fn err(self) -> Option<StdResult<RE, FE>>

Source

pub fn as_ref(&self) -> Result<&T, &RE, &FE>

Source

pub fn as_mut(&mut self) -> Result<&mut T, &mut RE, &mut FE>

Source

pub fn map<O>(self, f: impl FnOnce(T) -> O) -> Result<O, RE, FE>

Source

pub fn map_or<O>(self, default: O, f: impl FnOnce(T) -> O) -> O

Source

pub fn map_or_else<O>( self, default: impl FnOnce() -> O, f: impl FnOnce(T) -> O, ) -> O

Source

pub fn map_recoverable<REO>( self, f: impl FnOnce(RE) -> REO, ) -> Result<T, REO, FE>

Source

pub fn map_fatal<FEO>(self, f: impl FnOnce(FE) -> FEO) -> Result<T, RE, FEO>

Source

pub fn inspect(self, f: impl FnOnce(&T)) -> Self

Source

pub fn inspect_recoverable(self, f: impl FnOnce(&RE)) -> Self

Source

pub fn inspect_fatal(self, f: impl FnOnce(&FE)) -> Self

Source

pub fn as_deref(&self) -> Result<&T::Target, &RE, &FE>
where T: Deref,

Source

pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut RE, &mut FE>
where T: DerefMut,

Source

pub fn iter(&self) -> IntoIter<&T>

Source

pub fn iter_mut(&mut self) -> IntoIter<&mut T>

Source

pub fn expect_nonfatal(self, msg: &str) -> LocalResult<T, RE>
where FE: Debug,

Source

pub fn expect_ok(self, msg: &str) -> T
where RE: Debug, FE: Debug,

Source

pub fn unwrap_nonfatal(self) -> LocalResult<T, RE>
where FE: Debug,

Source

pub fn unwrap_ok(self) -> T
where RE: Debug, FE: Debug,

Source

pub fn unwrap_or_default(self) -> T
where T: Default,

Source

pub fn unwrap_or(self, default: T) -> T

Source

pub fn unwrap_or_else(self, default: impl FnOnce() -> T) -> T

Source

pub fn and<O>(self, res: Result<O, RE, FE>) -> Result<O, RE, FE>

Source

pub fn and_then<O>( self, f: impl FnOnce(T) -> Result<O, RE, FE>, ) -> Result<O, RE, FE>

Source

pub fn flatten_err<E: From<RE> + From<FE>>(self) -> StdResult<T, E>

Source

pub fn convert_err<REO: From<RE>, FEO: From<FE>>(self) -> Result<T, REO, FEO>

Source

pub fn more_fatal<REO>( self, f: impl FnOnce(RE) -> StdResult<REO, FE>, ) -> Result<T, REO, FE>

Source

pub fn less_fatal<FEO>( self, f: impl FnOnce(FE) -> StdResult<RE, FEO>, ) -> Result<T, RE, FEO>

Source

pub fn collect_layered<U>( iter: impl IntoIterator<Item = Result<U, RE, FE>>, ) -> Self
where T: FromIterator<U>,

Source§

impl<'a, T, RE, FE> Result<&'a T, RE, FE>

Source

pub fn map_deref(self) -> Result<&'a <T as Deref>::Target, RE, FE>
where T: Deref,

Source

pub fn copied(self) -> Result<T, RE, FE>
where T: Copy,

Source

pub fn cloned(self) -> Result<T, RE, FE>
where T: Clone,

Source§

impl<'a, T, RE, FE> Result<&'a mut T, RE, FE>

Source

pub fn map_deref(self) -> Result<&'a T::Target, RE, FE>
where T: DerefMut,

Source

pub fn map_deref_mut(self) -> Result<&'a mut T::Target, RE, FE>
where T: DerefMut,

Source

pub fn copied(self) -> Result<T, RE, FE>
where T: Copy,

Source

pub fn cloned(self) -> Result<T, RE, FE>
where T: Clone,

Source§

impl<T, RE, FE> Result<Result<T, RE, FE>, RE, FE>

Source

pub fn flatten(self) -> Result<T, RE, FE>

Trait Implementations§

Source§

impl<T: Clone, RE: Clone, FE: Clone> Clone for Result<T, RE, FE>

Source§

fn clone(&self) -> Result<T, RE, FE>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, RE: Debug, FE: Debug> Debug for Result<T, RE, FE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, RE, FE> From<LocalResult<T, RE>> for Result<T, RE, FE>

Source§

fn from(value: LocalResult<T, RE>) -> Self

Converts to this type from the input type.
Source§

impl<T, RE, FE> From<Result<Result<T, RE>, FE>> for Result<T, RE, FE>

Source§

fn from(value: StdResult<StdResult<T, RE>, FE>) -> Self

Converts to this type from the input type.
Source§

impl<T, RE, FE> From<Result<T, RE, FE>> for StdResult<StdResult<T, RE>, FE>

Source§

fn from(value: Result<T, RE, FE>) -> 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>>
where C: FromIterator<T>, EC: FromIterator<StdResult<RE, FE>>,

Source§

fn from_iter<I: IntoIterator<Item = Result<T, RE, FE>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T, RE, FE, C, REC, FEC> FromIterator<Result<T, RE, FE>> for CollectedErrs<Result<C, REC, FEC>>
where C: FromIterator<T>, REC: FromIterator<RE>, FEC: FromIterator<FE>,

Source§

fn from_iter<I: IntoIterator<Item = Result<T, RE, FE>>>(iter: I) -> Self

Creates a value from an iterator. Read more
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>,

Source§

fn from_iter<I: IntoIterator<Item = Result<T, RE, FE>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T, RE, FE, C> FromIterator<Result<T, RE, FE>> for Result<C, RE, FE>
where C: FromIterator<T>,

Source§

fn from_iter<I: IntoIterator<Item = Result<T, RE, FE>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

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

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

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

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

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

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

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

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

impl<T: Hash, RE: Hash, FE: Hash> Hash for Result<T, RE, FE>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, T, RE, FE> IntoIterator for &'a Result<T, RE, FE>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<&'a T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, RE, FE> IntoIterator for &'a mut Result<T, RE, FE>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<&'a mut T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, RE, FE> IntoIterator for Result<T, RE, FE>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Ord, RE: Ord, FE: Ord> Ord for Result<T, RE, FE>

Source§

fn cmp(&self, other: &Result<T, RE, FE>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq, RE: PartialEq, FE: PartialEq> PartialEq for Result<T, RE, FE>

Source§

fn eq(&self, other: &Result<T, RE, FE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd, RE: PartialOrd, FE: PartialOrd> PartialOrd for Result<T, RE, FE>

Source§

fn partial_cmp(&self, other: &Result<T, RE, FE>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T, RE, FE> Try for Result<T, RE, FE>

Source§

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>

🔬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 more
Source§

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 more
Source§

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 more
Source§

impl<T: Copy, RE: Copy, FE: Copy> Copy for Result<T, RE, FE>

Source§

impl<T: Eq, RE: Eq, FE: Eq> Eq for Result<T, RE, FE>

Source§

impl<T, RE, FE> StructuralPartialEq for Result<T, RE, FE>

Auto Trait Implementations§

§

impl<T, RE, FE> Freeze for Result<T, RE, FE>
where T: Freeze, RE: Freeze, FE: Freeze,

§

impl<T, RE, FE> RefUnwindSafe for Result<T, RE, FE>

§

impl<T, RE, FE> Send for Result<T, RE, FE>
where T: Send, RE: Send, FE: Send,

§

impl<T, RE, FE> Sync for Result<T, RE, FE>
where T: Sync, RE: Sync, FE: Sync,

§

impl<T, RE, FE> Unpin for Result<T, RE, FE>
where T: Unpin, RE: Unpin, FE: Unpin,

§

impl<T, RE, FE> UnwindSafe for Result<T, RE, FE>
where T: UnwindSafe, RE: UnwindSafe, FE: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.