Rust

Compiling and running Code

rustc main.rs
./main

cargo build
./main

cargo run

Println

println!("Hello World!");
println!("{}", string);
println!("You guessed: {guess}");

use (Imports)

Docs

use std::collections::hash_map::{self, HashMap};
use foo::Zoo as bar; // Rename
use foo::Zoo as _; // Avoid naming conflict
use foo::*; // glob

// Creates bindings to:
// - `std::collections::BTreeSet`
// - `std::collections::hash_map`
// - `std::collections::hash_map::HashMap`
use std::collections::{BTreeSet, hash_map::{self, HashMap}};

Debugging

rust guide

gdb target/debug/binary

list
break main
run