Skip to content

Install and Config

Install

  • windows

  • download from https : //www . rust-lang . org/tools/install

  • install rustup-init.exe
  • test with rustc --version

some example

  • entry
fn main(){
    // single line comment
    /* multi lines.
    the hello example.
    */
    println!("Hello, world!");
}
  • compile

rustc hello.rs

  • data types

  • Integer: i8, i64, i32, u8, u32, u64, usize/isize(can vary in size)...

  • Floating-point: f32, f64
  • Boolean: true/false.
  • String "in 8 hours"
  • Array: a = [1,2,3]
  • Slices: &a[e1...e10]
  • Tuple: t=(1,2,3)
  • Char: 'c'