rust-lang-nursery.github.io
Cookin' with Rust This Rust Cookbook is a collection of simple examples that demonstrate good practices to accomplish common programming tasks, using the crates of the Rust ecosystem. Read more about Rust Cookbook, including tips for how to...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
About "Cookin' with Rust" Table of contents • Who this book is for • How to read this book • How to use the recipes • A note about error handling • A note about crate representation Who this book is for This cookbook is intended for new Rus...
The Rust Cookbook
Book
2024-01-01
~3 min read
rust-lang-nursery.github.io
Algorithms | Recipe | Crates | Categories | |--------|--------|------------| | Generate random numbers | [![rand-badge]][rand] | [![cat-science-badge]][cat-science] | | Generate random numbers within a range | [![rand-badge]][rand] | [![cat...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Generate Random Values
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Sorting Vectors
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Asynchronous | Recipe | Crates | Categories| |-------|-------|----------| | Tokio Runtime |[![tokio-badge]][tokio]| [![cat-asynchronous-badge]][cat-asynchronous] | | Tokio Runtime Builder |[![tokio-badge]][tokio] [![std-badge]][std]| [![cat...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Async Runtime When your program asks for something that takes time, e.g reading a file, fetching data from a server, waiting for a timer, it has two choices: sit and wait doing nothing, or go do something else while it waits. Blocking means...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
File IO
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Timeouts [![tokio-badge]][tokio] [![std-badge]][std] Sometimes a task takes too long and you don't want to wait forever. A timeout puts a time limit on a task. If it finishes in time you get the result, if it doesn't, it is cancelled and yo...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Message Passing When your program has multiple tasks running at the same time, they sometimes need to talk to each other. Channels are how you do that, one task sends a message, another receives it. Think of it like a pipe: you put somethin...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Select First to Complete
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Structured Concurrency When your program runs multiple tasks at the same time, you need a way to keep track of them, know when they finish, collect their results, and clean up if something goes wrong. This section shows how to do that. Join...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Command Line | Recipe | Crates | Categories | |--------|--------|------------| | Parse command line arguments | [![std-badge]][std] | [![cat-command-line-badge]][cat-command-line] | | Clap Basic Argument Parsing | [![clap-badge]][clap] | [!...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Parse command line arguments
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
ANSI Terminal
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Environment Variables The env module lets you inspect and manipulate the process environment, including env vars, CLI args, and working directories. Get Environment Variables var fetches an env var from the current process. It returns Resul...
The Rust Cookbook
Book
2024-01-01
~2 min read
rust-lang-nursery.github.io
Compression | Recipe | Crates | Categories | |--------|--------|------------| | Decompress a tarball | [![flate2-badge]][flate2] [![tar-badge]][tar] | [![cat-compression-badge]][cat-compression] | | Compress a directory into a tarball | [![...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Working with Tarballs
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Concurrency | Recipe | Crates | Categories | |--------|--------|------------| | Spawn a short-lived thread | [![crossbeam-badge]][crossbeam] | [![cat-concurrency-badge]][cat-concurrency] | | Create a parallel data pipeline | [![crossbeam-ba...
The Rust Cookbook
Book
2024-01-01
~1 min read
rust-lang-nursery.github.io
Threads
The Rust Cookbook
Book
2024-01-01
~1 min read