Why Rust? A Practical Introduction for Web Developers
Rust is a compiled language that gives you C-level performance with memory safety guaranteed by the compiler, without a garbage collector. It powers parts of web browsers, operating systems, cloud infrastructure and a growing share of developer tooling.
Where you'll meet Rust
- JavaScript tooling: many fast bundlers, linters and formatters are written in Rust.
- Python tooling: fast package managers and linters such as uv and Ruff.
- Infrastructure: proxies, databases, serverless runtimes.
- WebAssembly: Rust compiles to Wasm well, so it runs in the browser too.
Install and run
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo new hello && cd hello
cargo run
// src/main.rs
fn main() {
let names = vec!["Asha", "Ravi", "Meera"];
for name in &names {
println!("Hello, {name}!");
}
let total: usize = names.iter().map(|n| n.len()).sum();
println!("{total} letters in total");
}
What feels different
- Ownership: every value has one owner; the compiler tracks who can read or change it. This replaces a garbage collector.
- No null: absence is
Option<T>, failure isResult<T, E>, and you must handle both. - Immutability by default: write
let mutwhen you need to change a variable. - A strict but helpful compiler: error messages explain the problem and often suggest the fix.
Is it worth learning?
The learning curve is real; expect a few weeks before you stop fighting the borrow checker. In return you get fast, reliable programs where whole classes of bugs (use-after-free, data races, null dereferences) can't compile. Good first projects: a CLI tool, a small web API, or a performance-critical function for an existing Node or Python app.
Was this article helpful?
Comments
No comments yet. Have a question or a tip? Be the first to share it.