Some Concepts in Rust

For

Rust中的for循环

1
2
3
for x in 1..10 {
// ...
}

等价于:

1
2
3
4
let mut iter = (1..10).into_iter();
while let Some(x) = iter.next() {
// ...
}

Ownership

Lifetime

Clone & Copy

dyn trait

Box, Rc, Arc

Send & Sync

Closure (Fn, FnMut, FnOnce)

Iter

Cell & RefCell

async