Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
pub trait Display
...As such, the output of Display might not be possible to parse, and even if it is, the result of parsing might not exactly match the original value. However, if a type has a lossless Display implementation whose output is meant to be conveniently machine-parseable and not just meant...
trait core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)
...42, 0); assert_eq!((r.0, r.1 != 0), u8::overflowing_mul(13, 42)); The value of the first field in the returned tuple matches what you'd get by combining the wrapping_mul and wrapping_add methods: #![feature(const_unsigned_bigint_helpers)] assert_eq!( 789_u16.carrying_mul(456...
method core Stable since 1.91.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)
...42, 0); assert_eq!((r.0, r.1 != 0), u8::overflowing_mul(13, 42)); The value of the first field in the returned tuple matches what you'd get by combining the wrapping_mul and wrapping_add methods: #![feature(const_unsigned_bigint_helpers)] assert_eq!( 789_u16.carrying_mul(456...
method core Stable since 1.91.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)
...42, 0); assert_eq!((r.0, r.1 != 0), u8::overflowing_mul(13, 42)); The value of the first field in the returned tuple matches what you'd get by combining the wrapping_mul and wrapping_add methods: #![feature(const_unsigned_bigint_helpers)] assert_eq!( 789_u16.carrying_mul(456...
method core Stable since 1.91.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)
...42, 0); assert_eq!((r.0, r.1 != 0), u8::overflowing_mul(13, 42)); The value of the first field in the returned tuple matches what you'd get by combining the wrapping_mul and wrapping_add methods: #![feature(const_unsigned_bigint_helpers)] assert_eq!( 789_u16.carrying_mul(456...
method core Stable since 1.91.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)
...42, 0); assert_eq!((r.0, r.1 != 0), u8::overflowing_mul(13, 42)); The value of the first field in the returned tuple matches what you'd get by combining the wrapping_mul and wrapping_add methods: #![feature(const_unsigned_bigint_helpers)] assert_eq!( 789_u16.carrying_mul(456...
method core Stable since 1.91.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)
...42, 0); assert_eq!((r.0, r.1 != 0), u8::overflowing_mul(13, 42)); The value of the first field in the returned tuple matches what you'd get by combining the wrapping_mul and wrapping_add methods: #![feature(const_unsigned_bigint_helpers)] assert_eq!( 789_u16.carrying_mul(456...
method core Stable since 1.91.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct SystemTime
...use std::time::{Duration, SystemTime}; use std::thread::sleep; fn main() { let now = SystemTime::now(); // we sleep for 2 seconds sleep(Duration::new(2, 0)); match now.elapsed() { Ok(elapsed) => { // it prints '2' println!("{}", elapsed.as_secs()); } Err(e) => { // the system clock went backwards! println!("Great Scott! {e:?}"); } } } Platform-specific...
struct std Stable since 1.8.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct Mutex<T>
...panic!(); }).join(); // The lock is poisoned by this point, but the returned result can be // pattern matched on to return the underlying guard on both branches. let mut guard = match lock.lock() { Ok(guard) => guard, Err(poisoned) => poisoned.into_inner(), }; *guard += 1; To unlock a mutex guard sooner than the...
struct std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub mod any
...want to // output the `String`'s length as well as its value. If not, it's a // different type: just print it out unadorned. match value_any.downcast_ref::<String>() { Some(as_string) => { println!("String ({}): {}", as_string.len(), as_string); } None => { println!("{value:?}"); } } } // This function wants to log its parameter...
module core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_inner(this: Self) -> Option<T>
...assert!(matches!( (x_inner_value, y_inner_value), (None, Some(3)) | (Some(3), None) )); // The result could also be `(None, None)` if the threads called // `Arc::try_unwrap(x).ok()` and `Arc::try_unwrap(y).ok()` instead. A more practical example demonstrating the need for Arc::into_inner: use std...
associated_function alloc Stable since 1.70.0 Version 1.100.0-nightly
doc.rust-lang.org
pub mod error
...the primary interfaces of the error system and the responsibilities they cover: • Result (Propagating, Reacting) • The Error trait (Reporting) • User defined types (Constructing / Representing) • match and downcast (Reacting) • The question mark operator (?) (Propagating) • The partially stable Try traits (Propagating, Constructing) • Termination (Reporting) Converting Errors into Panics The panic and error...
module core Stable since 1.81.0 Version 1.100.0-nightly
doc.rust-lang.org
pub mod error
...the primary interfaces of the error system and the responsibilities they cover: • Result (Propagating, Reacting) • The Error trait (Reporting) • User defined types (Constructing / Representing) • match and downcast (Reacting) • The question mark operator (?) (Propagating) • The partially stable Try traits (Propagating, Constructing) • Termination (Reporting) Converting Errors into Panics The panic and error...
module std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct BTreeMap<K, V, A>
...let to_find = ["Up!", "Office Space"]; for movie in &to_find { match movie_reviews.get(movie) { Some(review) => println!("{movie}: {review}"), None => println!("{movie} is unreviewed.") } } // Look up the value for a key (will panic if the key is not found). println!("Movie review: {}", movie_reviews["Office Space"]); // iterate over...
struct alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub trait PartialEq<Rhs>
...How can I implement PartialEq? An example implementation for a domain in which two books are considered the same book if their ISBN matches, even if the formats differ: enum BookFormat { Paperback, Hardback, Ebook, } struct Book { isbn: i32, format: BookFormat, } impl PartialEq for Book { fn eq(&self, other: &Self) -> bool...
trait core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct HashMap<K, V, S, A>
...let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"]; for &book in &to_find { match book_reviews.get(book) { Some(review) => println!("{book}: {review}"), None => println!("{book} is unreviewed.") } } // Look up the value for a key (will panic if the key is not found). println!("Review for Jane...
struct std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub mod io
...Instead, you can call .unwrap() or match on the return value to catch any possible errors: use std::io; let mut input = String::new(); io::stdin().read_line(&mut input).unwrap(); And a very common source of output is standard output: use std::io; use std::io::prelude::*; fn main...
module std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct Vec<T, A>
...using unsafe code to write to the excess capacity, and then increasing the length to match, is always valid. Currently, Vec does not guarantee the order in which elements are dropped. The order has changed in the past and may change again.
struct alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
primitive f32
...The result does not have to match what happens when executing the same code at runtime, and the result can vary depending on factors such as compiler version and flags. Target-specific "extra" NaN values | target_arch | Extra payloads possible on this platform | |---------------|------------------------------------------| | aarch64, arm, arm64ec, loongarch64, powerpc (except when...
primitive core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
primitive f32
...The result does not have to match what happens when executing the same code at runtime, and the result can vary depending on factors such as compiler version and flags. Target-specific "extra" NaN values | target_arch | Extra payloads possible on this platform | |---------------|------------------------------------------| | aarch64, arm, arm64ec, loongarch64, powerpc (except when...
primitive std Stable since 1.0.0 Version 1.100.0-nightly
"This viewpoint is very controversial, and I have no capacity to debate it with anyone who disagrees with me. But Rust has a very powerful macro system..."

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.
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.