Rust
Rust is a multi-paradigm, general-purpose programming language that emphasizes performance, type safety, and concurrency. It enforces memory safety, meaning that all references point to valid memory, without requiring the use of automated memory management techniques, such as garbage collection. To simultaneously enforce memory safety and prevent data races, its "borrow checker" tracks the object lifetime of all references in a program during compilation. Rust was influenced by ideas from functional programming, including immutability, higher-order functions, and algebraic data types. It is popular for systems programming.
See Rust on Wikipedia.
Getting started
The Pro Linux Containers of Brap are pre-installed with Rust.
To display and verify the installed version of Rust, run:
rustc -V
Here is a Hello, World!
program in Rust (~/.hello-world.rs
):
fn main() {
println!("Hello, World!");
}
To compile a Rust program, use the Rust compiler rustc
:
rustc hello-world.rs
The rustc
will produce a hello-world
binary that can be executed:
./hello-world
Screenshot: Hello, World! in Rust running in VS Code terminal
Keywords
- rust
- compiled
- low level