Skip to main content
This doc relates to the below revision of hardware
Mecha Logo

Comet (rev5)

For Pilot users

The all new Mecha Comet

Better in all ways, the next revision of Mecha Comet, coming soon.

Rust

Rust is a systems programming language that emphasizes performance, reliability, and productivity. It provides memory safety without garbage collection and supports concurrent programming without data races. Rust is particularly well-suited for developing system tools, embedded systems, and performance-critical applications.

Install rust using rustup

Rustup is the official installer and version management tool for Rust. To install rustup run the below command.

# Download and run the rustup installer script
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Load Rust environment variables into current shell session
. "$HOME/.cargo/env"

After installation, verify that Rust is properly installed

$ rustc --version
$ cargo --version

Running an example

Let's create a simple Hello World program to test the installation:

1

Create a new directory, and a new source file for your rust program.

$ mkdir hello_rust && cd hello_rust
$ nano main.rs
2

Paste the following program in the editor

fn main() {
println!("Hello, Rust!");
}
3

Now lets compile and run the program.

$ rustc main.rs
$ ./main
Hello, Rust!

You are now ready to run our favorite crustacean compiler 🦀!