to_vec, to_set andto_map are specializations of collect in the
usual case where you do want these containers.
use ToVec;
let v = "one two three".split_whitespace.to_vec;
assert_eq!;
There's a specialized form for collecting Result<T,E> into
Result<Vec<T>,E>, where the error is the first error encountered.
use ToVecResult;
let numbers = "23E 5F5 FF00".split_whitespace
.map.to_vec_result.unwrap;
assert_eq!;
to_map and to_set are different - they operate on iterators
of references and implicitly clone this.
use ToMap;
const VALUES: & = &;
let map = VALUES.iter.to_map;
assert_eq!;
assert_eq!;
This implicit cloning behaviour is very useful for sets (here defined
as HashSet):
use ToSet;
let colours = .iter.to_set;
let fruit = .iter.to_set;
let common = colours.intersection.to_set;
assert_eq!;