Enum MaybeTerminatedError

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

Source

pub fn unwrap(self) -> T

Trait Implementations§

Source§

impl<T: Debug> Debug for MaybeTerminatedError<T>

Source§

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

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

impl<T> From<MaybeTerminated<T>> for MaybeTerminatedError<T>

Source§

fn from(value: MaybeTerminated<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Result<T, Error>> for MaybeTerminatedError<T>

Source§

fn from(value: Result<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> FromResidual<MaybeTerminated<Infallible>> for MaybeTerminatedError<T>

Source§

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

impl<T> FromResidual<MaybeTerminatedError<Infallible>> for MaybeTerminatedError<T>

Source§

fn from_residual(residual: <Self as Try>::Residual) -> Self

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

impl<T, E> FromResidual<Result<Infallible, E>> for MaybeTerminatedError<T>
where E: Into<Error>,

Source§

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

impl<T> Try for MaybeTerminatedError<T>

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 = 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 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

Auto 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> 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> 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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.