Rust Control Flow

Control Flow The ability to run some code depending on whether a condition is true and to run some code repeatedly while a condition is true are basic building blocks in most programming languages. The most common constructs that let you control the flow of execution of Rust code are if expressions and loops.

July 31, 2025 · 1 min · Kristian Alexander P

Rust Enums

Defining Enum Where structs give you a way of grouping together related fields and data, like a Rectangle with its width and height, enums give you a way of saying a value is one of a possible set of values. For example, we may want to say that Rectangle is one of a set of possible shapes that also includes Circle and Triangle. To do this, Rust allows us to encode these possibilities as an enum. ...

July 31, 2025 · 5 min · Kristian Alexander P

Rust Functions

Functions Functions are prevalent in Rust code. You’ve already seen one of the most important functions in the language: the main function, which is the entry point of many programs. You’ve also seen the fn keyword, which allows you to declare new functions. Rust code uses snake case as the conventional style for function and variable names, in which all letters are lowercase and underscores separate words. Here’s a program that contains an example function definition: ...

July 31, 2025 · 1 min · Kristian Alexander P

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

Template expansion (The Org Manual)

Org-mode capture template expansion Links https://orgmode.org/manual/Template-expansion.html

July 31, 2025 · 1 min · Kristian Alexander P

virsh

virsh Virsh is a command-line interface (CLI) utility used for managing virtual machines (VMs) and other virtualization components, interacting with them through the Libvirt virtualization API. It allows users to create, manage, and control virtual machines, as well as interact with storage pools and networks within a virtualization environment. Backlinks libvirt libvirt

July 31, 2025 · 1 min · Kristian Alexander P

virt-manager

virt-manager virt-manager is a graphical tool, a frontend, for managing virtual machines (VMs) using libvirt. It primarily works with KVM (Kernel-based Virtual Machine) but also supports Xen and LXC containers. It offers features like creating and configuring new VMs, managing existing ones, monitoring performance, and accessing virtual consoles. Windows VM I can only get native resolution for windows vm using QXL Video mode.

July 31, 2025 · 1 min · Kristian Alexander P