Enum LocalResult

Source
pub enum LocalResult<T, RE> {
    NoErr(T),
    Handle(RE),
}

Variants§

§

NoErr(T)

§

Handle(RE)

Implementations§

Source§

impl<T, RE> LocalResult<T, RE>

Source

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

Source

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

Source

pub fn to_result<FE>(self) -> Result<T, 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 fn is_ok_or(self, f: impl FnOnce(RE) -> bool) -> bool

Source

pub const fn is_err(&self) -> bool

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Trait Implementations§

Source§

impl<T: Clone, RE: Clone> Clone for LocalResult<T, RE>

Source§

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

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> Debug for LocalResult<T, RE>

Source§

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

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

impl<T, RE> From<LocalResult<T, RE>> for StdResult<T, RE>

Source§

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

Converts to this type from the input type.
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> From<Result<T, RE>> for LocalResult<T, RE>

Source§

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

Converts to this type from the input type.
Source§

impl<T, RE, REO: From<RE>> FromResidual<LocalResult<Infallible, RE>> for LocalResult<T, REO>

only necessary because the ops::Try instance requires a FromResidual instance, this type is not intended to be used as a return type.

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, RE, REO: From<RE>, FEO> FromResidual<LocalResult<Infallible, RE>> for StdResult<StdResult<T, REO>, FEO>

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, 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: Hash, RE: Hash> Hash for LocalResult<T, RE>

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<T: Ord, RE: Ord> Ord for LocalResult<T, RE>

Source§

fn cmp(&self, other: &LocalResult<T, RE>) -> 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> PartialEq for LocalResult<T, RE>

Source§

fn eq(&self, other: &LocalResult<T, RE>) -> 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> PartialOrd for LocalResult<T, RE>

Source§

fn partial_cmp(&self, other: &LocalResult<T, RE>) -> 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> Try for LocalResult<T, RE>

Source§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
Source§

type Residual = LocalResult<Infallible, RE>

🔬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> Copy for LocalResult<T, RE>

Source§

impl<T: Eq, RE: Eq> Eq for LocalResult<T, RE>

Source§

impl<T, RE> StructuralPartialEq for LocalResult<T, RE>

Auto Trait Implementations§

§

impl<T, RE> Freeze for LocalResult<T, RE>
where T: Freeze, RE: Freeze,

§

impl<T, RE> RefUnwindSafe for LocalResult<T, RE>

§

impl<T, RE> Send for LocalResult<T, RE>
where T: Send, RE: Send,

§

impl<T, RE> Sync for LocalResult<T, RE>
where T: Sync, RE: Sync,

§

impl<T, RE> Unpin for LocalResult<T, RE>
where T: Unpin, RE: Unpin,

§

impl<T, RE> UnwindSafe for LocalResult<T, RE>
where T: UnwindSafe, RE: 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.