Rust: Difference between revisions
(Marked this version for translation) |
No edit summary |
||
Line 17: | Line 17: | ||
<!--T:5--> | <!--T:5--> | ||
2. Build and install | 2. Build and install the crate locally. This must be done from a login node. | ||
{{Command|cargo install ungoliant}} | {{Command|cargo install ungoliant}} | ||
Line 25: | Line 25: | ||
<!--T:7--> | <!--T:7--> | ||
You can also add < | You can also add <code>.cargo/bin</code> to your <code>$PATH</code> with: <code>export PATH="$HOME/.cargo/bin:$PATH"</code>. | ||
== Using the | == Using the Rust nightly compiler == <!--T:8--> | ||
Since some optimization features are not yet stable they are not part of the stable release, but nonetheless some crates make use of them. | Since some optimization features are not yet stable they are not part of the stable release, but nonetheless some crates make use of them. | ||
If you require the | If you require the Rust nightly compiler, you can install it locally. | ||
<!--T:9--> | <!--T:9--> |
Revision as of 17:10, 30 January 2023
Rust is a multi-paradigm, high-level, 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.
Module
The Rust compiler is available as a module.
[name@server ~]$ module spider rust
Installing a crate
A package written in Rust is called a crate.
1. Load the required modules.
[name@server ~]$ module load gcc/9.3.0 rust
2. Build and install the crate locally. This must be done from a login node.
[name@server ~]$ cargo install ungoliant
3. Test the binary.
[name@server ~]$ $HOME/.cargo/bin/ungoliant -h
You can also add .cargo/bin
to your $PATH
with: export PATH="$HOME/.cargo/bin:$PATH"
.
Using the Rust nightly compiler
Since some optimization features are not yet stable they are not part of the stable release, but nonetheless some crates make use of them. If you require the Rust nightly compiler, you can install it locally.
1. Install the compiler as a local module.
[name@server ~]$ eb Rust-1.53.0.eb --try-software-version=nightly --disable-enforce-checksums
2. Load the local module.
[name@server ~]$ module load rust/nightly