Skip to main content
Conversion from an Iterator. By implementing FromIterator for a type, you define how it will be created from an iterator. This is common for types which describe a collection of some kind. If you want to create a collection from the contents of an iterator, the Iterator::collect() method is preferred. However, when you need to specify the container type, FromIterator::from_iter() can be more readable than using a turbofish (e.g. ::>()). See the Iterator::collect() documentation for more examples of its use. See also: IntoIterator.

Signature

Examples

Basic usage:
Implementing FromIterator for your type:

Trait functions

from_iter

Creates a value from an iterator. See the module-level documentation for more.

Signature

Examples