Another #rust standard library awesomeness:
How to add things to an iterator if you have Some(&things)?
Easy:
`iter.chain(things.cloned().into_iter())`
That's pure awesomeness!
@musicmatze Nice one!
Even easier, if you have:let things: Option<T> = Some(T);
and a collection like Vec<T>, HashSet<T> etc. (everything that implements `Extend`):
Just do:vec.extend(thing);
This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!
@musicmatze Nice one!
Even easier, if you have:
let things: Option<T> = Some(T);
and a collection like Vec<T>, HashSet<T> etc. (everything that implements `Extend`):
Just do:
vec.extend(thing);