Rust

Fast, safe, concurrent programming language with strong type and memory safety.

Access

Credentials:

  • User: ferris
  • Password: (stored in /root/.cloudzy-creds)

SSH into server as root, then switch to the Rust user:

su - ferris

Important Directories

  • /home/ferris/.cargo/ → Cargo binaries (cargo, installed crates)
  • /home/ferris/.rustup/ → Rust toolchains & components
  • /home/ferris/ → Your workspace (projects live here)

Useful Commands

Verify installation:

cargo --version
rustc --version

Update Rust:

rustup update

Add/Update extra tools (e.g. linter):

rustup component add clippy

Uninstall Rust:

rustup self uninstall

Build your project:

cargo build

Run your project:

cargo run

Run tests:

cargo test

Build documentation for your project:

cargo doc --open

Publish a library to crates.io:

cargo publish

A Small Rust Application

Generate a new project:

cargo new hello-rust
cd hello-rust

Run the default program:

cargo run

Add a dependency via CLI:

cargo add ferris-says

Then build (Cargo will install our dependency for us):

cargo build

This will also generate Cargo.lock (dependency versions lockfile).

Edit src/main.rs:

use ferris_says::say;
use std::io::{stdout, BufWriter};


fn main() {
    let stdout = stdout();
    let message = String::from("Hello fellow Rustaceans!");
    let width = message.chars().count();


    let mut writer = BufWriter::new(stdout.lock());
    say(&message, width, &mut writer).unwrap();
}

Run it:

cargo run

Currently unavailable.

Application Details