Rust note: Frequent ways to convert collections

into_iter() consumes original collection

iter() borrows original collection

collection
    .into_iter()   // turn it into a stream of values
    .collect()     // rebuild into another collection
collection
    .iter()        // stream of references
    .copied()      // `copied()` for simple types like i32, or `cloned()` types that themselves own data
    .collect()

and often for some transformation

source.into_iter()
    .map(...)
    .filter(...)
    .collect::<TargetCollection>()