pub enum MaybeTerminatedError<T = ()> {
Done(T),
Terminated(Termination),
Error(Error),
}
Expand description
Return type for functions that either return a value, terminate early or error
Variants§
Done(T)
The operation finished with a return value
Terminated(Termination)
The operation was terminated early
Error(Error)
The operation failed
Implementations§
Source§impl<T> MaybeTerminatedError<T>
impl<T> MaybeTerminatedError<T>
Trait Implementations§
Source§impl<T: Debug> Debug for MaybeTerminatedError<T>
impl<T: Debug> Debug for MaybeTerminatedError<T>
Source§impl<T> From<MaybeTerminated<T>> for MaybeTerminatedError<T>
impl<T> From<MaybeTerminated<T>> for MaybeTerminatedError<T>
Source§fn from(value: MaybeTerminated<T>) -> Self
fn from(value: MaybeTerminated<T>) -> Self
Converts to this type from the input type.
Source§impl<T> FromResidual<MaybeTerminated<Infallible>> for MaybeTerminatedError<T>
impl<T> FromResidual<MaybeTerminated<Infallible>> for MaybeTerminatedError<T>
Source§fn from_residual(residual: MaybeTerminated<Infallible>) -> Self
fn from_residual(residual: MaybeTerminated<Infallible>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moreSource§impl<T> FromResidual<MaybeTerminatedError<Infallible>> for MaybeTerminatedError<T>
impl<T> FromResidual<MaybeTerminatedError<Infallible>> for MaybeTerminatedError<T>
Source§impl<T, E> FromResidual<Result<Infallible, E>> for MaybeTerminatedError<T>
impl<T, E> FromResidual<Result<Infallible, E>> for MaybeTerminatedError<T>
Source§fn from_residual(residual: Result<Infallible, E>) -> Self
fn from_residual(residual: Result<Infallible, E>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moreSource§impl<T> Try for MaybeTerminatedError<T>
impl<T> Try for MaybeTerminatedError<T>
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 = MaybeTerminatedError<Infallible>
type Residual = MaybeTerminatedError<Infallible>
🔬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 moreAuto Trait Implementations§
impl<T> Freeze for MaybeTerminatedError<T>where
T: Freeze,
impl<T> RefUnwindSafe for MaybeTerminatedError<T>where
T: RefUnwindSafe,
impl<T> Send for MaybeTerminatedError<T>where
T: Send,
impl<T> Sync for MaybeTerminatedError<T>where
T: Sync,
impl<T> Unpin for MaybeTerminatedError<T>where
T: Unpin,
impl<T> UnwindSafe for MaybeTerminatedError<T>where
T: 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more