Enum efficient_enum::option::OptionMut
[−]
[src]
pub enum OptionMut<'a, A: 'a> { IsNone(OptionNoneMut<'a, A>), IsSome(OptionSomeMut<'a, A>), }
A helper type for Option
, gives access to OptionNoneMut
and
OptionSomeMut
variants.
Variants
IsNone(OptionNoneMut<'a, A>)
IsSome(OptionSomeMut<'a, A>)
Methods
impl<'a, A> OptionMut<'a, A>
[src]
impl<'a, A> OptionMut<'a, A>
[src]
fn expect_some(self, msg: &str) -> OptionSomeMut<'a, A>
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
.
fn expect_none(self, msg: &str) -> OptionNoneMut<'a, A>
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
.
fn unwrap_some(self) -> OptionSomeMut<'a, A>
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
.
fn unwrap_none(self) -> OptionNoneMut<'a, A>
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
.
fn unwrap_some_or(self, default: OptionSomeMut<'a, A>) -> OptionSomeMut<'a, A>
Returns the contained IsSome
value or a default.
fn unwrap_none_or(self, default: OptionNoneMut<'a, A>) -> OptionNoneMut<'a, A>
Returns the contained IsNone
value or a default.
fn unwrap_some_or_else<F>(self, f: F) -> OptionSomeMut<'a, A> where
F: FnOnce(OptionNoneMut<'a, A>) -> OptionSomeMut<'a, A>,
F: FnOnce(OptionNoneMut<'a, A>) -> OptionSomeMut<'a, A>,
Returns the contained IsSome
value or computes it from a closure.
fn unwrap_none_or_else<F>(self, f: F) -> OptionNoneMut<'a, A> where
F: FnOnce(OptionSomeMut<'a, A>) -> OptionNoneMut<'a, A>,
F: FnOnce(OptionSomeMut<'a, A>) -> OptionNoneMut<'a, A>,
Returns the contained IsNone
value or computes it from a closure.
fn map_some_or<U, F>(self, default: U, f: F) -> U where
F: FnOnce(OptionSomeMut<'a, A>) -> U,
F: FnOnce(OptionSomeMut<'a, A>) -> U,
Applies a function to the contained IsSome
value or returns a default
.
fn map_none_or<U, F>(self, default: U, f: F) -> U where
F: FnOnce(OptionNoneMut<'a, A>) -> U,
F: FnOnce(OptionNoneMut<'a, A>) -> U,
Applies a function to the contained IsNone
value or returns a default
.
fn map<U, D, F>(self, default: D, f: F) -> U where
D: FnOnce(OptionNoneMut<'a, A>) -> U,
F: FnOnce(OptionSomeMut<'a, A>) -> U,
D: FnOnce(OptionNoneMut<'a, A>) -> U,
F: FnOnce(OptionSomeMut<'a, A>) -> U,
Applies a function to the contained IsSome
value or computes a default
from the IsNone
.