Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
Interior mutability Sometimes a type needs to be mutated while having multiple aliases. In Rust this is achieved using a pattern called interior mutability. A type has interior mutability if its internal state can be changed through a share...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Type layout The layout of a type is its size, alignment, and the relative offsets of its fields. For enums, how the discriminant is laid out and interpreted is also part of type layout. Type layout can be changed with each compilation. Inst...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~16 min read
Dynamically sized types Most types have a fixed size that is known at compile time and implement the trait Sized. A type with a size that is known only at run-time is called a dynamically sized type (DST) or, informally, an unsized type. Sl...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Inferred type InferredType -> `_` The inferred type asks the compiler to infer the type if possible based on the surrounding information available. [!EXAMPLE] The inferred type is often used in generic arguments: let x: Vec<_> = (0..10).col...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Type parameters Within the body of an item that has type parameter declarations, the names of its type parameters are types: fn to_vec<A: Clone>(xs: &[A]) -> Vec<A> { if xs.is_empty() { return vec![]; } let first: A = xs[0].clone(); let mut...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Impl trait ImplTraitType -> `impl` Bounds ImplTraitTypeOneBound -> `impl` TraitBound impl Trait provides ways to specify unnamed but concrete types that implement a specific trait. It can appear in two sorts of places: argument position (wh...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~5 min read
Trait objects TraitObjectType -> `dyn`? Bounds TraitObjectTypeOneBound -> `dyn`? TraitBound A trait object is an opaque value of another type that implements a set of traits. The set of traits is made up of a dyn compatible base trait plus...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~2 min read
Function pointer types BareFunctionType -> ForLifetimes? FunctionTypeQualifiers `fn` `(` FunctionParametersMaybeNamedVariadic? `)` BareFunctionReturnType? FunctionTypeQualifiers -> `unsafe`? (`extern` Abi?)? BareFunctionReturnType -> `->` T...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Pointer types All pointers are explicit first-class values. They can be moved or copied, stored into data structs, and returned from functions. References (& and &mut) ReferenceType -> `&` Lifetime? `mut`? TypeNoBounds Shared references (&)...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~2 min read
Closure types A closure expression produces a closure value with a unique, anonymous type that cannot be written out. A closure type is approximately equivalent to a struct which contains the captured values. For instance, the following clo...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~20 min read
Function item types When referred to, a function item, or the constructor of a tuple-like struct or enum variant, yields a zero-sized value of its function item type. That type explicitly identifies the function - its name, its type argumen...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Union types A union type is a nominal, heterogeneous C-like union, denoted by the name of a union item. Unions have no notion of an "active field". Instead, every union access transmutes parts of the content of the union to the type of the...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Enumerated types An enumerated type is a nominal, heterogeneous disjoint union type, denoted by the name of an enum item. [^enumtype] An enum item declares both the type and a number of variants, each of which is independently named and has...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Struct types A struct type is a heterogeneous product of other types, called the fields of the type.[^structtype] New instances of a struct can be constructed with a struct expression. The memory layout of a struct is undefined by default t...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Slice types SliceType -> `[` Type `]` A slice is a dynamically sized type representing a 'view' into a sequence of elements of type T. The slice type is written as [T]. Slice types are generally used through pointer types. For example: • &[...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Array types ArrayType -> `[` Type `;` Expression `]` An array is a fixed-size sequence of N elements of type T. The array type is written as [T; N]. The size is a constant expression that evaluates to a usize. Examples: // A stack-allocated...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Tuple types TupleType -> `(` `)` | `(` ( Type `,` )+ Type? `)` Tuple types are a family of structural types[^1] for heterogeneous lists of other types. The syntax for a tuple type is a parenthesized, comma-separated list of types. 1-ary tup...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Never type NeverType -> `!` The never type ! is a type with no values, representing the result of computations that never complete. Expressions of type ! can be coerced into any other type. The ! type can only appear in function return type...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
String slice type The string slice (str) type represents a sequence of characters. let greeting1: &str = "Hello, world!"; let greeting2: &str = "你好,世界"; [!NOTE] See [the standard library docs][str] for information on the impls of the str ty...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
Character type The char type represents a single Unicode scalar value (i.e., a code point that is not a surrogate). [!EXAMPLE] let c: char = 'a'; let emoji: char = '😀'; let unicode: char = '\u{1F600}'; [!NOTE] See [the standard library docs...
doc.rust-lang.org The Rust Reference Book 2024-01-01 ~1 min read
"Failure is not an OPTION<T\>. It’s a Result<T, E\>."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, and research. 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.