The snippet library.
Small, practical examples. Search by task or narrow things down below.
Compare ASCII text ignoring case
Compare ASCII text ignoring case in a complete Rust program using the standard library.
Rust✓ Tested
Compile and run your first Rust program
Compile and run your first Rust program in a complete Rust program using the standard library.
Rust✓ Tested
Construct a named-field struct
Construct a named-field struct in a complete Rust program using the standard library.
Rust✓ Tested
Construct a struct with default values
Construct a struct with default values in a complete Rust program using the standard library.
Rust✓ Tested
Construct an instant relative to the Unix epoch
Construct an instant relative to the Unix epoch in a complete Rust program using the standard library.
Rust✓ Tested
Copy a file and inspect the copied byte count
Copy a file and inspect the copied byte count in a complete Rust program using the standard library.
Rust✓ Tested
Count values with the entry API
Count values with the entry API in a complete Rust program using the standard library.
Rust✓ Tested
Create a file without replacing existing data
Create a file without replacing existing data in a complete Rust program using the standard library.
Rust✓ Tested
Create a fixed-size array
Create a fixed-size array in a complete Rust program using the standard library.
Rust✓ Tested
Create a nested directory tree
Create a nested directory tree in a complete Rust program using the standard library.
Rust✓ Tested
Declare a typed constant
Declare a typed constant in a complete Rust program using the standard library.
Rust✓ Tested
Decode bytes as validated UTF-8
Decode bytes as validated UTF-8 in a complete Rust program using the standard library.
Rust✓ Tested