- rust-lang examples to illustrate various rust concepts and standard libs.
- note: I followed site https://doc.rust-lang.org/rust-by-example during example journey.
- while most of the examples are mine,here you may find some example copied/mutated originating from https://doc.rust-lang.org/rust-by-example.
🧠 Notes
1.'rust-examples' is a workspace , and each subdirectory is a cargo directory (project folder managed by cargo).
2. All .rs files in src/bin/ are treated as separate binaries automatically.
3.If you put multiple files in src/ directly (like main1.rs, main2.rs), Cargo will not pick them up unless you declare them manually with [[bin]].
- 0.0 formatting
- 1.0 primitives
- 1.1 primitive scalar
- 1.2 primitive compound
- 1.3 primitive operators
- 2.0 custom types
- 2.1 structs
- 3.0 var bindings
- 4.0 types
- 4.1 type casting
- 4.2 type inference
- 4.3 type aliasing
- 5.0 conversion
- 5.1 conversion trait 'From'
- 5.2 conversion trait 'Into'
- 5.3 conversion traits 'TryFrom & TryInto'
- 5.4 conversion string traits 'ToString, Display, parse(), parse::() '
- 6.0 expression
- 7.0 flow of control
- 7.1 if else
- 7.2 for
- 7.3 if let
- 7.4 loop
- 7.5 match
- 7.5.1 match destructing
- 7.5.2 match guard
- 7.5.3 match binding
- 7.6 while
- 8 functions
- 8.1 function closures
- 9 modules
- 9.1 module hierarchy 0
- 9.2 module hierarchy 1
- 9.3 module hierarchy 2
- 10 crates
- 10.1 crates create
- 10.2 crates create lib
- 10.3 crates use lib
- 11 cargo
- 11.1 cargo dependencies
- 11.2 cargo conventions
- 11.3 cargo tests
- 12 generics
- a references (Reference samples with different types)
- b tricks (Programing trick samples)
- c exe (Executable samples)
- d array(Array samples)
- e vector(Vector samples)