Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
Alternative representations Rust allows you to specify alternative data layout strategies from the default. repr(C) This is the most important repr. It has fairly simple intent: do what C does. The order, size, and alignment of fields is ex...
The Rustonomicon Book 2024-01-01 ~6 min read
doc.rust-lang.org
Exotically Sized Types Most of the time, we expect types to have a statically known and positive size. This isn't always the case in Rust. Dynamically Sized Types (DSTs) Rust supports Dynamically Sized Types (DSTs): types without a statical...
The Rustonomicon Book 2024-01-01 ~5 min read
doc.rust-lang.org
repr(Rust) First and foremost, all types have an alignment specified in bytes. The alignment of a type specifies what addresses are valid to store the value at. A value with alignment n must only be stored at an address that is a multiple o...
The Rustonomicon Book 2024-01-01 ~4 min read
doc.rust-lang.org
Data Representation in Rust Low-level programming cares a lot about data layout. It's a big deal. It also pervasively influences the rest of the language, so we're going to start by digging into how data is represented in Rust. This chapter...
The Rustonomicon Book 2024-01-01 ~1 min read
doc.rust-lang.org
Working with Unsafe Rust generally only gives us the tools to talk about Unsafe Rust in a scoped and binary manner. Unfortunately, reality is significantly more complicated than that. For instance, consider the following toy function: fn in...
The Rustonomicon Book 2024-01-01 ~3 min read
doc.rust-lang.org
What Unsafe Rust Can Do The only things that are different in Unsafe Rust are that you can: • Dereference raw pointers • Call unsafe functions (including C functions, compiler intrinsics, and the raw allocator) • Implement unsafe traits • A...
The Rustonomicon Book 2024-01-01 ~3 min read
doc.rust-lang.org
How Safe and Unsafe Interact What's the relationship between Safe Rust and Unsafe Rust? How do they interact? The separation between Safe Rust and Unsafe Rust is controlled with the unsafe keyword, which acts as an interface from one to the...
The Rustonomicon Book 2024-01-01 ~6 min read
doc.rust-lang.org
Meet Safe and Unsafe safe and unsafe It would be great to not have to worry about low-level implementation details. Who could possibly care how much space the empty tuple occupies? Sadly, it sometimes matters and we need to worry about it....
The Rustonomicon Book 2024-01-01 ~2 min read
doc.rust-lang.org
The Rustonomicon Warning: This book is incomplete. Documenting everything and rewriting outdated parts take a while. See the issue tracker to check what's missing/outdated, and if there are any mistakes or ideas that haven't been reported,...
The Rustonomicon Book 2024-01-01 ~2 min read
doc.rust-lang.org
Playground The Rust Playground is a way to experiment with Rust code through a web interface. Using it with mdbook In mdbook, you can make code examples playable and editable. fn main() { println!("Hello World!"); } This allows the reader t...
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
Documentation Use cargo doc to build documentation in target/doc, cargo doc --open will automatically open it in your web browser. Use cargo test to run all tests (including documentation tests), and cargo test --doc to only run documentati...
Rust by Example Book 2024-01-01 ~2 min read
doc.rust-lang.org
Meta Some topics aren't exactly relevant to how your program runs but provide you tooling or infrastructure support which just makes things better for everyone. These topics include: • Documentation: Generate library documentation for users...
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
Raw identifiers Rust, like many programming languages, has the concept of "keywords". These identifiers mean something to the language, and so you cannot use them in places like variable names, function names, and other places. Raw identifi...
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
Compatibility The Rust language is evolving rapidly, and because of this certain compatibility issues can arise, despite efforts to ensure forwards-compatibility wherever possible. • Raw identifiers
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
Inline assembly Rust provides support for inline assembly via the asm! macro. It can be used to embed handwritten assembly in the assembly output generated by the compiler. Generally this should not be necessary, but might be where the requ...
Rust by Example Book 2024-01-01 ~15 min read
doc.rust-lang.org
Unsafe Operations As an introduction to this section, to borrow from the official docs, "one should try to minimize the amount of unsafe code in a code base." With that in mind, let's get started! Unsafe annotations in Rust are used to bypa...
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
Development dependencies Sometimes there is a need to have dependencies for tests (or examples, or benchmarks) only. Such dependencies are added to Cargo.toml in the [dev-dependencies] section. These dependencies are not propagated to other...
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
Integration testing Unit tests are testing one module in isolation at a time: they're small and can test private code. Integration tests are external to your crate and use only its public interface in the same way any other code would. Thei...
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
Documentation testing The primary way of documenting a Rust project is through annotating the source code. Documentation comments are written in CommonMark Markdown specification and support code blocks in them. Rust takes care about correc...
Rust by Example Book 2024-01-01 ~2 min read
doc.rust-lang.org
Unit testing Tests are Rust functions that verify that the non-test code is functioning in the expected manner. The bodies of test functions typically perform some setup, run the code we want to test, then assert whether the results are wha...
Rust by Example Book 2024-01-01 ~4 min read
"I'm not here to tell you that Rust is the best language....... you should have figured that out by now."

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.