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

Bind a value with let

Bind a value with let in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Borrow text without transferring ownership

Borrow text without transferring ownership in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Calculate an order subtotal

Calculate an order subtotal in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Call a typed function

Call a typed function in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Choose an action with match

Choose an action with match in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Choose floating-point arithmetic

Choose floating-point arithmetic in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Clone an owned value explicitly

Clone an owned value explicitly in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Combine Boolean conditions

Combine Boolean conditions in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

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
RustGetting Started

Construct a named-field struct

Construct a named-field struct in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Create a fixed-size array

Create a fixed-size array in a complete Rust program using the standard library.

Rust✓ Tested
RustGetting Started

Declare a typed constant

Declare a typed constant in a complete Rust program using the standard library.

Rust✓ Tested