A word from our sponsors

Introduction

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 a garbage collector. 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.

Software developer Graydon Hoare created Rust as a personal project while working at Mozilla Research in 2006. Mozilla officially sponsored the project in 2009. In the years following the first stable release in May 2015, Rust was adopted by companies including Amazon, Discord, Dropbox, Google (Alphabet), Meta, and Microsoft. In December 2022, it became the first language other than C and assembly to be supported in the development of the Linux kernel.

Rust has been noted for its rapid adoption, and has been studied in programming language theory research.

Links

General

Docs

FIXME

Articles

Files and Directories

FIXME

General Files and Directories

FIXME

Configuration Files

FIXME

Getting Help

Manual pages:

user@host:~$ man 1 rustc
user@host:~$ man 1 rustdoc
user@host:~$ man 1 cargo
user@host:~$ man 1 cargo-<SUBCOMMAND>

Builtin Cargo help:

user@host:~$ cargo help
user@host:~$ cargo help <SUBCOMMAND>
user@host:~$ cargo <SUBCOMMAND> --help

Install

To install Rust and its build toolchain and package manager Cargo on Debian:

root@host:~$ apt-get -y install rustc cargo

To install Rust and its build toolchain and package manager Cargo from a more recent version on Debian:

root@host:~$ apt-get -y install rustc-mozilla cargo-mozilla

Configuration

FIXME

Usage

Creating a new project

user@host:~$ cargo new hello_world

Compile and run a project

Compile and run a project *with* debugging information:

user@host:~$ cd hello_world
user@host:~/hello_world$ cargo run
user@host:~/hello_world$ du -sm target/debug/hello_world

Compile and run a project *optimized* and *without* debugging information:

user@host:~/hello_world$ cargo run --release

Clean a project

Clean a project from the artefacts of a previous compile and run:

user@host:~/hello_world$ cargo clean

Add a dependency to a project

Add a external library dependency to a project. E.g. ferris-says:

user@host:~/hello_world$ cargo add ferris-says

Manually add a external library dependency to a project. E.g. ferris-says:

user@host:~/hello_world$ vi Cargo.toml

File contents:

hello_world/Cargo.toml
[...]
 
[dependencies]
ferris-says = "0.2.1"

Update the projects main code:

user@host:~/hello_world$ vi src/main.rs

File contents:

hello_world/src/main.rs
use ferris_says::say;
use std::io::{stdout, BufWriter};
 
fn main() {
    let stdout = stdout();
    let message = b"Hello fellow Rustaceans!";
    let width = 24;
 
    let mut writer = BufWriter::new(stdout.lock());
    say(message, width, &mut writer).unwrap();
}

Compile and run the updated project:

user@host:~/hello_world$ cargo run

Set a dependency to a specific version in a project

Set a first and second level dependency to a specific version in a project:

user@host:~/hello_world$ cargo update -p unicode-width --precise 0.1.7 
user@host:~/hello_world$ cargo update -p smawk --precise 0.3.0

FIXME

Status Check

FIXME

To check the status of :

root@host:~$ 

Recipies

FIXME

this namespace doesn't exist: prog:rust:recipies

Known Issues

FIXME

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website. More information about cookies