Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
"If manually managing memory is like wielding a gun, the borrow checker is an automatic safety that prevents you from pulling the trigger when you're r..."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.