FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

25 snippets foundClear filters
RustGetting Started

Destructure a tuple

Destructure a tuple in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Grow a vector

Grow a vector in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Handle a parsing Result

Handle a parsing Result in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Handle an optional value

Handle an optional value in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Loop over an inclusive range

Loop over an inclusive range in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Match enum variants

Match enum variants in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Modify a value through a mutable borrow

Modify a value through a mutable borrow in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Print a collection for inspection

Print a collection for inspection in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Repeat while a condition holds

Repeat while a condition holds in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Return a value from a loop

Return a value from a loop in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Transform a value by shadowing

Transform a value by shadowing in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Update an explicitly mutable variable

Update an explicitly mutable variable in a complete Rust program using the standard library.

Rust✓ Tested