As Wikipedia says, Rust is a multi-paradigm, high-level, general-purpose programming language designed for performance and safety, especially safe concurrency. Rust is syntactically similar to C++, but can guarantee memory safety by using a borrow checker to validate references. Rust achieves memory safety without garbage collection, and reference counting is optional.

Developing with Rust on Debian

Debian ships rustc (the Rust compiler), cargo (the Rust package manager and build system), rustfmt (the Rust code formatter), a number of packages written in Rust or including modules written in Rust, and a growing number of Rust crates (Rust libraries).

Using crates from Debian

Due to the way Rust and the Rust crates are packaged in Debian, packages shipping Rust crates are mainly useful when packaging other crates or Rust-based software for Debian. While you can use them for everyday development with Rust, their main use is as dependencies for other applications since Debian doesn't allow downloading source code at build-time.

To only use the local (Debian) version of crates, place the following snippet in a .cargo/config file at your projects' root:

[source]
[source.debian-packages]
directory = "/usr/share/cargo/registry"
[source.crates-io]
replace-with = "debian-packages"

.. and install any of its crate dependencies via apt install librust-CRATE-dev  (or declare them in debian/control if it's for a package).

Using crates from the Internet

For everyday Rust development, you may find rustup useful, as it provides a convenient way to install Rust toolchains and switch between them globally or on a per-project basis.

# Install rustup
$ sudo apt install rustup

# Use the latest stable Rust release from upstream
$ rustup default stable

# Read the official documentation "The Rust Programming Language"
$ rustup docs --book

Using Rust Analyzer

The Rust Analyzer extension for VS Code comes with the binary of the analyzer, but it doesn’t come with the source code of the Rust standard library, which is required for the analyzer to operate. Debian ships the source code as rust-src.

Other editors require downloading the binary manually. Packaging is requested in 1052319.

Packaging Rust applications and crates

For packaging:


CategorySoftware | CategoryProgramming