The Rust programming language is syntactically similar to C++ and is designed for performance and safety, especially safe concurrency.
The usual assumption is that you need to install rust
in order to use or compile rust
. However, you must install rustc
in order to compile programs written in Rust.
aptitude install rustc
For Debian 10 Buster the dependencies are:
cargo gdb libbabeltrace-ctf1 libbabeltrace1 libc6-dbg libdw1 libhttp-parser2.1
libllvm7 libstd-rust-1.34 libstd-rust-dev rust-gdb
For Debian 11 Bullseye the dependencies are:
cargo gdb libbabeltrace1 libc6-dbg libdebuginfod1 libsource-highlight-common
libsource-highlight4v5 libstd-rust-1.48 libstd-rust-dev rust-gdb
The famous source code for ‘Hello World!’ in Rust is:
echo 'fn main() {' > hello-world.rs
echo ' println!("Hello World!");' >> hello-world.rs
echo '}' >> hello-world.rs
This will give the file hello-world.rs
with the content
fn main() {
println!("Hello World!");
}
Compiling
rustc hello-world.rs
Executing
./hello-world
Hello World!
Version | Date | Notes |
---|---|---|
0.1.3 | 2023-01-18 | Improve writing, add hello-world.rs link |
0.1.2 | 2022-10-26 | Documentation |
0.1.1 | 2022-07-07 | Debian 11 Bullseye, shell->bash, commands |
0.1.0 | 2020-09-05 | Initial release |