Skip to content

Rust

  • Rust automatically tries by adding &, &mut, * in method calling syntax if the object doesn't define the method
  • A struct can have multiple impl blocks

modules

  • a package contains cargo.toml and consists of 1+ crate
  • a crate can be a binary crate or a library crate consisting of modules
  • A module abc can have its source, inline within {}, or abc.rs, or abc/mod.rs
  • Child module code is private from parent's, but vice versa is not true
  • A binary crate's root file is main.rs, and library crate's root file is lib.rs
  • Absolute path of a module begins with crate::, whereas relative path begins either with self::, or super::, or a module name that exists at the current level