Skip to content

Glossary: Rust Beyond the Basics

collect

Also written: collect()

An iterator consumer that gathers items into a collection such as a `Vec`, `HashMap` or `String`, or into a single `Result`. You usually tell it the target type with an annotation or the turbofish.

Where the book teaches it

Related terms

consumerturbofish