Rust Primitive Types, Functions, Control Flow, and Placeholders
Integer Types
Rust provides signed and unsigned integers in various bit widths:
Bit Width Signed Unsigned
8-bit i8 u8
16-bit i16 u16
32-bit i32 u32
64-bit i64 u64
128-bit i128 u128
arch-dependent isize usize
Example declarations:
let val_i8: i8 = 1;
let val_u8: u8 = 1;
let val_i16: i16 ...
Posted on Wed, 19 Aug 2026 16:35:14 +0000 by bal bal
Understanding Rust's Cow Smart Pointer Through Source Code Analysis
Rust's Cow (Copy-on-Write) is a smart pointer that enables lazy cloning. It's useful when data might be mutated or ownership might change, but you want to avoid unnecessary copies—ideal for read-heavy, write-rare scenarios.
pub enum Cow<'a, B: ?Sized + 'a>
where
B: ToOwned,
{
/// Borrowed data.
Borrowed(&'a B),
/// Own ...
Posted on Sun, 16 Aug 2026 16:40:05 +0000 by vadercole
Accelerating Python Performance with Rust
Rust offers significant performance advantages over Python, a dynamically-typed interpreted language. While Python excels in rapid development and flexibility, its execution speed can be a bottleneck for computationally intensive tasks. This article explores the performance disparity between Python and Rust and demonstrates how to leverage Rust ...
Posted on Sun, 16 Aug 2026 16:09:07 +0000 by jdock1
Understanding Pinning and Self-Referential Futures in Rust
In Rust, an async fn functions as a generator for a state machine. Rather than executing the logic immediately, it returns an anonymous type that implements the Future trait.
use std::future::Future;
async fn compute_value() -> u32 {
123
}
The semantics of a Future represent a value that might become available eventually. These objects ...
Posted on Sat, 15 Aug 2026 16:23:38 +0000 by gikon
Accessing Associated Values in Rust Enums
In Rust, enumerations are powerful data structures that allow vairants to hold specific data types, including tuples and structs. When working with tuple-like variants, developers often need to extract and utilize the inner values. This process is primarily handled through pattern matching and destructuring. Below are several techniques to acce ...
Posted on Mon, 10 Aug 2026 16:19:30 +0000 by nailzfan
Understanding Box::pin in Rust Async Recursion
In Rust, Box::pin serves as a critical tool for handling recursive asynchronous functions where the compiler cannot determine the size of the returned Future. To fully grasp its application, we need to explore several foundational concepts: asynchronous functions, Future traits, and dynamically sized types.
The Core Issue: Recursive Futures and ...
Posted on Wed, 05 Aug 2026 16:29:47 +0000 by eyedol
Implementing a Rust Parser with Logos and LALRPOP for AST Construction
Project Setup
This guide demonstrates how to create a complete Rust application that combines logos for lexical analysis and lalrpop for parsing with abstract syntax tree (AST) generation. We'll build a mathematical expression processor with the following components:
Dependency Configuration
Begin by updating your Cargo.toml with the required ...
Posted on Mon, 03 Aug 2026 16:34:48 +0000 by AlGale
Installing and Configuring Zed Editor on Windows
As of October 2025, Zed Editor has an official Windows release. However, community-maintained versions via package managers like Scoop remain viable alternatives. Zed, written in Rust, has gained significant attention in the developer community. Initially released for macOS, Windows users had to compile from source until community builds became ...
Posted on Tue, 28 Jul 2026 16:55:16 +0000 by roustabout
Token Position Tracking in LALRPOP
When developing parsers, it is often crucial to identify the exact byte offset of tokens within the input stream. This capability is particularly valuable for generating precise error messages or for implementing featurse like syntax highlighting and linting.
LALRPOP facilitates this through two dedicated tracking macros: @L and @R. The @L macr ...
Posted on Tue, 28 Jul 2026 16:43:19 +0000 by greeneel
Computing All Integer Factors in Ascending Order with Rust
A straightforward Rust implementation for finding all factors of a number is shown below. This approach iterates up to the square root of the input value.
fn compute_factors_simple(num: u64) -> Vec<u64> {
let sqrt_val = (num as f64).sqrt().floor() as u64;
let mut factors = Vec::new();
for divisor in 1..=sqrt_val {
i ...
Posted on Tue, 28 Jul 2026 16:25:21 +0000 by pazzy