pub enum Outcome<T> {
Determinate(T),
Indeterminate(Indeterminacy),
}Expand description
A value, or the reason there is none.
There is deliberately no Deref and no accessor that returns a value for the
indeterminate case: the way to a number goes through a match, Outcome::value
or Outcome::into_result, each of which says what happens otherwise.
Variants§
Implementations§
Source§impl<T> Outcome<T>
impl<T> Outcome<T>
Sourcepub const fn is_determinate(&self) -> bool
pub const fn is_determinate(&self) -> bool
Returns true when there is an answer.
Sourcepub const fn indeterminacy(&self) -> Option<&Indeterminacy>
pub const fn indeterminacy(&self) -> Option<&Indeterminacy>
The reason there is no answer, if there is none.
Sourcepub fn into_result(self) -> Result<T, Indeterminacy>
pub fn into_result(self) -> Result<T, Indeterminacy>
The answer, or the reason it is missing.
§Errors
Returns the Indeterminacy when no defensible answer exists.
Sourcepub const fn as_result(&self) -> Result<&T, &Indeterminacy>
pub const fn as_result(&self) -> Result<&T, &Indeterminacy>
Borrows the answer, or the reason it is missing.
§Errors
Returns the Indeterminacy when no defensible answer exists.
Trait Implementations§
impl<T: Eq> Eq for Outcome<T>
impl<T: PartialEq> StructuralPartialEq for Outcome<T>
Auto Trait Implementations§
impl<T> Freeze for Outcome<T>where
T: Freeze,
impl<T> RefUnwindSafe for Outcome<T>where
T: RefUnwindSafe,
impl<T> Send for Outcome<T>where
T: Send,
impl<T> Sync for Outcome<T>where
T: Sync,
impl<T> Unpin for Outcome<T>where
T: Unpin,
impl<T> UnsafeUnpin for Outcome<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Outcome<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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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