doc.rust-lang.org
pub const fn get_or_insert_default(&mut self) -> &mut T
Inserts the default value into the option if it is None, then returns a mutable reference to the contained value.
method
core
Stable since 1.83.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn get_or_insert(&mut self, value: T) -> &mut T
Inserts value 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
doc.rust-lang.org
pub const fn flatten(self) -> Option<T>
Converts from Option<Option<T>> to Option<T>.
method
core
Stable since 1.40.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn filter<P>(self, predicate: P) -> Self
Returns None if the option is None, otherwise calls predicate with the wrapped value and returns:
method
core
Stable since 1.27.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn expect(self, msg: &str) -> T
Returns the contained Some value, consuming the self value.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn copied(self) -> Option<T>
Maps an Option<&T> to an Option<T> by copying the contents of the option.
method
core
Stable since 1.35.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn cloned(self) -> Option<T>
Maps an Option<&T> to an Option<T> by cloning the contents of the option.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_slice(&self) -> &[T]
Returns a slice of the contained value, if any. If this is None, an empty slice is returned. This can be useful to have a single type of iterator over an Option or slice.
method
core
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_ref(&self) -> Option<&T>
Converts from &Option<T> to Option<&T>.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>>
Converts from Pin<shared reference&Option<T>> to Option<Pin<shared reference&T>>.
method
core
Stable since 1.33.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>>
Converts from Pin<mutable reference&mut Option<T>> to Option<Pin<mutable reference&mut T>>.
method
core
Stable since 1.33.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_mut_slice(&mut self) -> &mut [T]
Returns a mutable slice of the contained value, if any. If this is None, an empty slice is returned. This can be useful to have a single type of iterator over an Option or slice.
method
core
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_mut(&mut self) -> Option<&mut T>
Converts from &mut Option<T> to Option<&mut T>.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_deref_mut(&mut self) -> Option<&mut <T as >::Target>
Converts from Option<T> (or &mut Option<T>) to Option<&mut T::Target>.
method
core
Stable since 1.40.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_deref(&self) -> Option<&<T as >::Target>
Converts from Option<T> (or &Option<T>) to Option<&T::Target>.
method
core
Stable since 1.40.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn and_then<U, F>(self, f: F) -> Option<U>
Returns None if the option is None, otherwise calls f with the wrapped value and returns the result.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn and<U>(self, optb: Option<U>) -> Option<U>
Returns None if the option is None, otherwise returns optb.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub enum Option<T>
The Option type. See the module level documentation for more.
enum
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct IterMut<'a, A>
An iterator over a mutable reference to the Some variant of an Option.
struct
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Iter<'a, A>
An iterator over a reference to the Some variant of an Option.
struct
core
Stable since 1.0.0
Version 1.100.0-nightly