doc.rust-lang.org
pub const fn take_if<P>(&mut self, predicate: P) -> Option<T>
Takes the value out of the option, but only if the predicate evaluates to true on a mutable reference to the value.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn take(&mut self) -> Option<T>
Takes the value out of the option, leaving a None in its place.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn replace(&mut self, value: T) -> Option<T>
Replaces the actual value in the option by the value given in parameter, returning the old value if present, leaving a Some in its place without deinitializing either one.
method
core
Stable since 1.31.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn or_else<F>(self, f: F) -> Option<T>
Returns the option if it contains a value, otherwise calls f and returns the result.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn or(self, optb: Option<T>) -> Option<T>
Returns the option if it contains a value, otherwise returns optb.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(err()).
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn ok_or<E>(self, err: E) -> Result<T, E>
Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(err).
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
Computes a default function result (if none), or applies a different function to the contained value (if any).
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn map_or_default<U, F>(self, f: F) -> U
Maps an Option<T> to a U by applying function f to the contained value if the option is Some, otherwise if None, returns the default value for the type U.
method
core
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn map_or<U, F>(self, default: U, f: F) -> U
Returns the provided default result (if none), or applies a function to the contained value (if any).
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn map<U, F>(self, f: F) -> Option<U>
Maps an Option<T> to Option<U> by applying a function to a contained value (if Some) or returns None (if None).
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Returns a mutable iterator over the possibly contained value.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter(&self) -> Iter<'_, T>
Returns an iterator over the possibly contained value.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_some_and(self, f: impl ~const FnOnce(T) -> bool) -> bool
Returns true if the option is a Some and the value inside of it matches a predicate.
method
core
Stable since 1.70.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_some(&self) -> bool
Returns true if the option is a Some value.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_none_or(self, f: impl ~const FnOnce(T) -> bool) -> bool
Returns true if the option is a None or the value inside of it matches a predicate.
method
core
Stable since 1.82.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_none(&self) -> bool
Returns true if the option is a None value.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn inspect<F>(self, f: F) -> Self
Calls a function with a reference to the contained value if Some.
method
core
Stable since 1.76.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn insert(&mut self, value: T) -> &mut T
Inserts value into the option, then returns a mutable reference to it.
method
core
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T
Inserts a value computed from f into the option if it is None, then returns a mutable reference to the contained value.
method
core
Stable since 1.20.0
Version 1.100.0-nightly