Jump to: navigation, search
Rust is a multi-paradigm, general-purpose programming language. Rust emphasizes performance, type safety, and concurrency. Rust enforces memory safety—that is, that all references point to valid memory—without requiring the use of a garbage collector or reference counting present in other memory-safe languages. To simultaneously enforce memory safety and prevent concurrent data races, Rust's "borrow checker" tracks the object lifetime of all references in a program during compilation. Rust is popular for systems programming but also offers high-level features including some functional programming constructs.

Install Rust

For Rust programming, You need the following tools:

  • Rust (the compiler, linker and debugger)
  • Cargo (the package manager)
  • Text editor of your choice

For most users, you only need to install the stable version of Rust and Cargo. This can be done in one single command:

user $ sudo zypper install rustup && rustup toolchain install stable

You can then update your toolchains at any time with.

user $ rustup update

Advanced installations


For advanced users who need nightly version of Rust, you can install rustup and then install nightly version of Rust:

user $ rustup toolchain install nightly

Use the same version as openSUSE packaging

If you wish to build against the version of rust that is used in openSUSE for package building (not recommended) you can first uninstall rustup:

user $ sudo zypper rm rustup

and then install directly cargo from the repositories:

user $ sudo zypper install cargo

Note the distributed version of rust does not have the language server or other IDE integrations.

More rustup usage examples...

Create a Rust project

Cargo is the package manager of Rust. And it can also create Rust projects:

user $ cargo new world_hello && cd world_hello

The created project has the following structure:

├── .git
├── .gitignore
├── Cargo.toml  # the project information and dependencies
└── src
    └── # the main source code

To quickly run your project:

user $ cargo run

You will see output like:

Compiling world_hello v0.1.0 (/home/bob/world_hello)
    Finished dev [unoptimized + debuginfo] target(s) in 0.43s
     Running `target/debug/world_hello`
Hello, world!

Learn Rust Programming

Packaging Software Written in Rust

See the detailed packaging guide: Packaging Rust Software

To help improve OBS/IBS performance, you may also wish to Enable sccache for improving rebuild times

Packaging the Rust Compiler

See the detailed guide: Packaging Rustlang

Rust in OpenSUSE Survey Results

September 2021

Analysis - maintainer writeup

Report from rust survey - combined partial and full results

Full report from the rust survey - fully complete results