pub enum LocalResult<T, RE> {
NoErr(T),
Handle(RE),
}
Variants§
Implementations§
Source§impl<T, RE> LocalResult<T, RE>
impl<T, RE> LocalResult<T, RE>
pub fn from_std(res: StdResult<T, RE>) -> Self
pub fn to_std(self) -> StdResult<T, RE>
pub fn to_result<FE>(self) -> Result<T, RE, FE>
pub const fn is_ok(&self) -> bool
pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool
pub fn is_ok_or(self, f: impl FnOnce(RE) -> bool) -> bool
pub const fn is_err(&self) -> bool
pub fn is_err_and(self, f: impl FnOnce(RE) -> bool) -> bool
pub fn is_err_or(self, f: impl FnOnce(T) -> bool) -> bool
pub fn ok(self) -> Option<T>
pub fn err(self) -> Option<RE>
pub fn expect(self, msg: &str) -> Twhere
RE: Debug,
pub fn unwrap(self) -> Twhere
RE: Debug,
Trait Implementations§
Source§impl<T: Clone, RE: Clone> Clone for LocalResult<T, RE>
impl<T: Clone, RE: Clone> Clone for LocalResult<T, RE>
Source§fn clone(&self) -> LocalResult<T, RE>
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)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T, RE> From<LocalResult<T, RE>> for StdResult<T, RE>
impl<T, RE> From<LocalResult<T, RE>> for StdResult<T, RE>
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> 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> From<Result<T, RE>> for LocalResult<T, RE>
impl<T, RE> From<Result<T, RE>> for LocalResult<T, RE>
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.
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
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, RE, REO: From<RE>, FEO> FromResidual<LocalResult<Infallible, RE>> for StdResult<StdResult<T, REO>, FEO>
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
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, 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: Ord, RE: Ord> Ord for LocalResult<T, RE>
impl<T: Ord, RE: Ord> Ord for LocalResult<T, RE>
Source§fn cmp(&self, other: &LocalResult<T, RE>) -> Ordering
fn cmp(&self, other: &LocalResult<T, RE>) -> Ordering
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> PartialOrd for LocalResult<T, RE>
impl<T: PartialOrd, RE: PartialOrd> PartialOrd for LocalResult<T, RE>
Source§impl<T, RE> Try for LocalResult<T, RE>
impl<T, RE> Try for LocalResult<T, RE>
Source§type Output = T
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>
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 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> Copy for LocalResult<T, RE>
impl<T: Eq, RE: Eq> Eq for LocalResult<T, RE>
impl<T, RE> StructuralPartialEq for LocalResult<T, RE>
Auto Trait Implementations§
impl<T, RE> Freeze for LocalResult<T, RE>
impl<T, RE> RefUnwindSafe for LocalResult<T, RE>where
T: RefUnwindSafe,
RE: RefUnwindSafe,
impl<T, RE> Send for LocalResult<T, RE>
impl<T, RE> Sync for LocalResult<T, RE>
impl<T, RE> Unpin for LocalResult<T, RE>
impl<T, RE> UnwindSafe for LocalResult<T, RE>where
T: UnwindSafe,
RE: 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