std::iter::Extend
Trait std::iter::Extend
pub trait Extend<A> { fn extend<T>(&mut self, iter: T) where T: IntoIterator<Item = A>; }
Extend a collection with the contents of an iterator.
Iterators produce a series of values, and collections can also be thought of as a series of values. The Extend
trait bridges this gap, allowing you to extend a collection by including the contents of that iterator. When extending a collection with an already existing key, that entry is updated or, in the case of collections that permit multiple entries with equal keys, that entry is inserted.
Examples
Basic usage:
// You can extend a String with some chars: let mut message = String::from("The first three letters are: "); message.extend(&['a', 'b', 'c']); assert_eq!("abc