linux:rust

This is an old revision of the document!


Rust cheatlist

  • cargo new project_name: Initializes a new Rust project named project_name in the current directory.
  • cargo build: Build program without optimizations. Output is stored in ./target/debug.
  • cargo build –release: Build program with runtime optimizations. Output is stored in ./target/release.
  • let foo = bar;: Creates immutable variable foo and assigns it value bar.
  • let mut foo = bar;: Creates mutable varibale foo and assigns it value bar.
  • Associated function: functione implemented on a type rather than on a particular instance of the type. Similar as a static method in Java.
  • Macro:
  • Prelude:
  • Trait:
  • &var: Passes var as a reference. Allows a function to access a variable without the need to copy it to the function's stack.
  • &mut var: Passes var as a mutable reference. Allows a function to access and alter the variable's value.
  • linux/rust.1612112622.txt.gz
  • Last modified: 2021/01/31 18:03
  • by kurt.smolderen@empuly.net