cd ../blog
DUMMY POST

Why I Love Rust

2024-01-15 • 3 min read

Rust has fundamentally changed how I think about systems programming. Here's a quick look at what makes it special.

Ownership & Borrowing

The ownership system is Rust's killer feature. It guarantees memory safety at compile time without needing a garbage collector.

main.rs
fn main() {
    let s1 = String::from("hello");
    let s2 = s1; // s1 is moved!

    println!("{}", s2);
}

Zero-Cost Abstractions

High-level code compiles down to the same assembly as hand-written low-level code. You don't pay for what you don't use.

iterators.rs
let sum: i32 = (1..100)
    .filter(|x| x % 2 == 0)
    .map(|x| x * x)
    .sum();

Fearless Concurrency

The compiler prevents data races at compile time. If it compiles, it's thread-safe.

// This is a dummy post for demonstration purposes.