rust match

match Control flow construct Rust has an extremely powerful control flow construct called match that allows you to compare a value against a series of patterns and then execute code based on which pattern matches. Patterns can be made up of literal values, variable names, wildcards, and many other things. Think of a match expression as being like a coin-sorting machine: coins slide down a track with variously sized holes along it, and each coin falls through the first hole it encounters that it fits into. In the same way, values go through each pattern in a match, and at the first pattern the value “fits,” the value falls into the associated code block to be used during execution. ...

July 31, 2025 · 3 min · Kristian Alexander P

Rust Ownership

Understanding Ownership Ownership is Rust’s most unique feature and has deep implications for the rest of the language. It enables Rust to make memory safety guarantees without needing a garbage collector, so it’s important to understand how ownership works. In this chapter, we’ll talk about ownership as well as several related features: borrowing, slices, and how Rust lays data out in memory.

July 31, 2025 · 1 min · Kristian Alexander P

rust resources

Rust free and online resources Links https://www.youtube.com/@letsgetrusty

July 31, 2025 · 1 min · Kristian Alexander P

rust variables

Immutable By default rust variables are immutable. Once a value is bound to a name, you can’t change that value. We can make a mutable variable using the keyword mut. fn main() { let mut x = 5; println!("The value of x is: {x}"); x = 6; println!("The value of x is: {x}"); } The value of x is: 5 The value of x is: 6 Constant. Like immutable variables, constants are values that are bound to a name and are not allowed to change, but there are a few differences between constants and variables. First, you aren’t allowed to use mut with constants. Constants aren’t just immutable by default—they’re always immutable. You declare constants using the const keyword instead of the let keyword, and the type of the value must be annotated. We’ll cover types and type annotations in the next section, “Data Types”, so don’t worry about the details right now. Just know that you must always annotate the type. ...

July 31, 2025 · 3 min · Kristian Alexander P

rust hello world

Hello world The basic hello world in Rust. fn main() { // Statements here are executed when the compiled binary is called. // Print text to the console. println!("Hello World!"); } Backlinks rustup

February 25, 2024 · 1 min · Kristian Alexander P

rustup

Install rust Get the installer script here for linux, but also support other os’es like windows. In archlinux, using rustup is the recommended way to install if you intend to program anything in Rust.

February 25, 2024 · 1 min · Kristian Alexander P