Rust basics: what the language is and where it is used
About the Rust language
Rust is a compiled programming language focused on safety and speed.
The compiler checks memory use at build time, so many bugs are caught
before the program ever runs.
Ownership, borrowing and lifetimes let the compiler prove that every
value has one clear owner and that references stay valid. The result is
memory safety without a garbage collector: no pauses for collection and
no data races, null dereferences or use-after-free errors.
A new stable release arrives every six weeks. Editions from 2015 through
2024 compile side by side, so old code keeps working while new features
stay opt-in.
Where Rust is used
Typical domains are systems tools, command line utilities, network
services, embedded firmware and browser modules built with WebAssembly.
One codebase can produce a native binary for each target, so deployment
is often a single file with no extra runtime to install.
That makes Rust practical for tools that must start fast and run with
small memory use. The language runs on common desktop and server systems
such as Linux, macOS and Windows.
Hello, Rust
Every runnable Rust program starts in the main function. Save this text as main.rs, build it with rustc and start the binary:
fn main() {
println!("Hello, Rust");
}
rustc main.rs
./main
Hello, Rust
Inside a cargo project the shorter cargo run command builds and starts the program in one step.
The course
The
Rust course
takes the same first program through fifty lessons: variables, ownership,
traits, generics, threads and two capstone projects, a word frequency CLI
and a tiny HTTP server. Every lesson ends with a button to the next one.
Systems background helps for the later lessons: see
C.
The code on this page was run with rustc 1.96.1 on Alpine Linux 3.24.3 (x86_64) in a Docker container.
Article author: Arthur Isaev