-
install cargo
-
hello world
-
variable
- immutable by default
let
- type
mut
- constant
- shadowing
-
scalar types
- i32, u32, f32, boolean, char
- integer overflow
- type conversion
-
compound data types
- array
- array - collection of elements with length known at compile time
- slice - collection of elements with length known at runtime
- tuple
- pattern matching
- array
-
function
- no return value
- return value
- implicit return
-
control flow
- if / else
- match
- if let
- let else
-
loop
- for and range
- while
- while let
- returning values from loop
-
returning values from block expression
-
ownership
- stack (last in, first out)
- store data with known fixed size
- heap
- vec (stack = vec pointer, data = heap)
- Each value in Rust has an owner.
- There can only be one owner at a time. (Transfer of ownership)
- When the owner goes out of scope, the value will be dropped.
- passing variable into function
- stack (last in, first out)
-
borrow
- reference
- mutable reference
- no dangling refe
-
slice
-
string and str
- str - string with length known at runtime
r#
-
struct
- update syntax
- method (impl)
- derive
-
enum
-
error handling
- panic
- option
- result
- ?
- box dyn error
- expect, unwrap
-
generic types
impl <T> MyStruct<T>
-
trait
- default
- trait fn input
- trait bound,
+
,where
- trait object
- return impl from func
- From and Into
- Add and Mul
- fmt::Display
-
lifetimes
- static
-
closures
- fn traits (Fn, FnMut and FnOnce) (TODO)
- where syntax, dynamic dispatch
- difference between func pointer and fn traits and closure
-
iterators
- iter - doesn't take ownership (iterate by reference)
- into_iter - takes ownership (moves items into new scope)
- map, filter, filter_map, fold, flatten
- sort_by ?
-
collection
- vector
- slice
- hash map
- hash set
-
mod
-
smart pointers
- Box
- Rc
- arc
-
associated types
-
advanced types
- assoc type
trait Add<Rhs=Self>
(default type parameter)- difference between Clone and Copy
- Sized
-
dbg, println!("{:#?}")
-
default
-
scope
-
concurrency
- thread
- channel
- mutex
- async
-
dereference
-
Box<dyn Error>
-
cow
-
ref mut
-
todo!()
-
thread scope
https://github.com/wh5a/rustlings-solutions/tree/main/exercises
- ast
- graph
- secant method
- create address
- create2 address
- merkle proof
- mpt proof
- FFT
- zkp
- spinner
- anzan
- real time code sharing editor