pub enum EfficientOptionInner<'a, A, B: 'a, TM: 'a = TagMSB>where
A: TaggableValue<TM, One> + 'a,{
IsNone(EfficientOptionInnerNone<'a, A, B, TM>),
IsSome(EfficientOptionInnerSome<'a, A, B, TM>),
}
Expand description
A helper type for EfficientOption
, gives access to EfficientOptionInnerNone
and
EfficientOptionInnerSome
variants.
Variants§
IsNone(EfficientOptionInnerNone<'a, A, B, TM>)
IsSome(EfficientOptionInnerSome<'a, A, B, TM>)
Implementations§
Source§impl<'a, TM, A, B> EfficientOptionInner<'a, A, B, TM>where
A: TaggableValue<TM, One>,
impl<'a, TM, A, B> EfficientOptionInner<'a, A, B, TM>where
A: TaggableValue<TM, One>,
Sourcepub fn expect_some(self, msg: &str) -> EfficientOptionInnerSome<'a, A, B, TM>
pub fn expect_some(self, msg: &str) -> EfficientOptionInnerSome<'a, A, B, TM>
Unwraps an option, yielding the content of a IsSome
.
§Panics
Panics if the value is a IsNone
with a custom panic message provided by
msg
.
Sourcepub fn expect_none(self, msg: &str) -> EfficientOptionInnerNone<'a, A, B, TM>
pub fn expect_none(self, msg: &str) -> EfficientOptionInnerNone<'a, A, B, TM>
Unwraps an option, yielding the content of a IsNone
.
§Panics
Panics if the value is a IsSome
with a custom panic message provided by
msg
.
Sourcepub fn unwrap_some(self) -> EfficientOptionInnerSome<'a, A, B, TM>
pub fn unwrap_some(self) -> EfficientOptionInnerSome<'a, A, B, TM>
Moves the value v
out if it is IsSome(v)
.
In general, because this function may panic, its use is discouraged.
Instead, prefer to use pattern matching and handle the IsNone
case explicitly.
§Panics
Panics if the self value equals IsNone
.
Sourcepub fn unwrap_none(self) -> EfficientOptionInnerNone<'a, A, B, TM>
pub fn unwrap_none(self) -> EfficientOptionInnerNone<'a, A, B, TM>
Moves the value v
out if it is IsNone(v)
.
In general, because this function may panic, its use is discouraged.
Instead, prefer to use pattern matching and handle the IsSome
case explicitly.
§Panics
Panics if the self value equals IsSome
.
Sourcepub fn unwrap_some_or(
self,
default: EfficientOptionInnerSome<'a, A, B, TM>,
) -> EfficientOptionInnerSome<'a, A, B, TM>
pub fn unwrap_some_or( self, default: EfficientOptionInnerSome<'a, A, B, TM>, ) -> EfficientOptionInnerSome<'a, A, B, TM>
Returns the contained IsSome
value or a default.
Sourcepub fn unwrap_none_or(
self,
default: EfficientOptionInnerNone<'a, A, B, TM>,
) -> EfficientOptionInnerNone<'a, A, B, TM>
pub fn unwrap_none_or( self, default: EfficientOptionInnerNone<'a, A, B, TM>, ) -> EfficientOptionInnerNone<'a, A, B, TM>
Returns the contained IsNone
value or a default.
Sourcepub fn unwrap_some_or_else<F>(
self,
f: F,
) -> EfficientOptionInnerSome<'a, A, B, TM>
pub fn unwrap_some_or_else<F>( self, f: F, ) -> EfficientOptionInnerSome<'a, A, B, TM>
Returns the contained IsSome
value or computes it from a closure.
Sourcepub fn unwrap_none_or_else<F>(
self,
f: F,
) -> EfficientOptionInnerNone<'a, A, B, TM>
pub fn unwrap_none_or_else<F>( self, f: F, ) -> EfficientOptionInnerNone<'a, A, B, TM>
Returns the contained IsNone
value or computes it from a closure.
Sourcepub fn map_some_or<U, F>(self, default: U, f: F) -> Uwhere
F: FnOnce(EfficientOptionInnerSome<'a, A, B, TM>) -> U,
pub fn map_some_or<U, F>(self, default: U, f: F) -> Uwhere
F: FnOnce(EfficientOptionInnerSome<'a, A, B, TM>) -> U,
Applies a function to the contained IsSome
value or returns a default
.
Sourcepub fn map_none_or<U, F>(self, default: U, f: F) -> Uwhere
F: FnOnce(EfficientOptionInnerNone<'a, A, B, TM>) -> U,
pub fn map_none_or<U, F>(self, default: U, f: F) -> Uwhere
F: FnOnce(EfficientOptionInnerNone<'a, A, B, TM>) -> U,
Applies a function to the contained IsNone
value or returns a default
.
Sourcepub fn map<U, D, F>(self, default: D, f: F) -> Uwhere
D: FnOnce(EfficientOptionInnerNone<'a, A, B, TM>) -> U,
F: FnOnce(EfficientOptionInnerSome<'a, A, B, TM>) -> U,
pub fn map<U, D, F>(self, default: D, f: F) -> Uwhere
D: FnOnce(EfficientOptionInnerNone<'a, A, B, TM>) -> U,
F: FnOnce(EfficientOptionInnerSome<'a, A, B, TM>) -> U,
Applies a function to the contained IsSome
value or computes a default
from the IsNone
.