Rust
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:
sudo zypper install rustup && rustup toolchain install stable
You can then update your toolchains at any time with.
rustup update
Advanced installations
Nightly
For advanced users who need nightly version of Rust, you can install rustup and then install nightly version of Rust:
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:
sudo zypper rm rustup
and then install directly cargo
from the repositories:
sudo zypper install cargo
Note the distributed version of rust does not have the language server or other IDE integrations.
Create a Rust project
Cargo is the package manager of Rust. And it can also create Rust projects:
cargo new world_hello && cd world_hello
The created project has the following structure:
├── .git ├── .gitignore ├── Cargo.toml # the project information and dependencies └── src └── main.rs # the main source code
To quickly run your project:
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