Rust

Installation

Install rustup:

brew install rustup-init
rustup-init

Install Rust Language Server:

rustup update
rustup component add rls-preview rust-analysis rust-src

Install the Rust Language Server VSCode extension

Hello World

From Rust by Example:

// hello.rs
fn main() {
    println!("Hello World!");
}
rustc hello.rs
./hello

Packaging etc

  • Packaging is done with Cargo

  • Each distributed package is called a Crate

  • The primary Crate registry is Crates.io

  • A simple starting guide is here

To create a new project, then compile and run it:

cargo new rust_example
cd rust_example
cargo run

Last updated