Pragmatic Rust
I. Rust install

Debian details:
Debian Linux has rustc, and using apt install works fine, but doesn't include cargo (rust package manager),

- but should use cargo
- So -install.
  - adds ~\.cargo
  - adds to ~\.profile
  - adds rustup for itself, and cargo and rustc for rust-compiler

For other OS: use

In Vim, add Ale in vim plugins dir for in-editor syntax & compilation errors.

II. Rust project

$ cargo init
(edit src/main.rsi Hello -text, save)
$ cargo run

What is #[test]?

  A: Test code for this file, see next answer:

What is #[cfg(test)]?

  A: Instruction for cargo build tool that the next code is test module, and contains 'mod tests' -block. To run tests use 
     $ cargo test
     Tests are also run when
     $ cargo run

     See more:

III. Rust proggy


IV. Debugging Rust

Rust compiler output to see parse tree and resulting intermediate code?

Rust debugging with dfb?
1. Compile 
2. set debugger to single thread mode
3. > gdb rust-executable
4. (gdb) run
5. How to set breakpoint, view stack or heap?
   (gdb) break functionName
   (gdb) run 
   (gdb) frame
   (gdb) n

V. Rust Theory

- Olisko siistiä jos tää oliskin rust-ohjelma jota voi lukea

Rust concepts
- stack, heapo

- Variables
  - pass something by value
  - move when passed in function, copy when int/char/primitive
  - ownership/borrowing &
  - "&" - pass something by reference - f.ex. "&my_var"
      calculate_sum( &entries );
      fn calculate_sum(index: &vec) -> Integer { index = do stuff ... }
      - Aliasing Model

  - mutating mut vars are passed/defined in fn with "&mut"

  - &str[4..5] - string slice type -> "&str"
    - points to a slice of the binary
    - also type &[i32]

- Struct

- Lifetimes

Rust REPL??
Rust inline-debugger?
Rust linting

VI. Rust idioms

12:11 < frogzilla> Easiest way to convert Vec, E>> to Vec? 
12:13 < dpc1> map, unwrap(x2), collect

- underline
- open file? stream?
- match
- self
- traits
- Display trait
Rust examples?