The snippet library.
Small, practical examples. Search by task or narrow things down below.
Define behavior with a trait
Define behavior with a trait in a complete Rust program using the standard library.
Rust✓ Tested
Derive comparison and debugging behavior
Derive comparison and debugging behavior in a complete Rust program using the standard library.
Rust✓ Tested
Destructure a tuple
Destructure a tuple in a complete Rust program using the standard library.
Rust✓ Tested
Detect invalid UTF-8 data
Detect invalid UTF-8 data in a complete Rust program using the standard library.
Rust✓ Tested
Distinguish UTF-8 bytes from characters
Distinguish UTF-8 bytes from characters in a complete Rust program using the standard library.
Rust✓ Tested
Encode an integer as big-endian bytes
Encode an integer as big-endian bytes in a complete Rust program using the standard library.
Rust✓ Tested
Exercise a function with a table of inputs
Exercise a function with a table of inputs in a complete Rust program using the standard library.
Rust✓ Tested
Express a duration in milliseconds
Express a duration in milliseconds in a complete Rust program using the standard library.
Rust✓ Tested
Find common set members
Find common set members in a complete Rust program using the standard library.
Rust✓ Tested
Find members missing from another set
Find members missing from another set in a complete Rust program using the standard library.
Rust✓ Tested
Find the first matching value
Find the first matching value in a complete Rust program using the standard library.
Rust✓ Tested
Flatten nested collections
Flatten nested collections in a complete Rust program using the standard library.
Rust✓ Tested