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 www.rustup.rs -install.
  - adds ~\.cargo
  - adds to ~\.profile
  - adds rustup for itself, and cargo and rustc for rust-compiler

For other OS: use rustup.rs

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: https://doc.rust-lang.org/1.5.0/book/testing.html



III. Rust proggy

(todo)


IV. Debugging Rust

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

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

Rust concepts
- stack, heap
- pass something by reference
- pass something by value
- ownership/borrowing &
- mutating mut

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?