Skip to content

Glossary: Data Structures and Algorithms in Rust

retain

Also written: retain()

A `Vec` method that keeps only the items for which a closure returns true and removes the rest, in place. For example, it can drop one road from a place's list of neighbors.

Where the book teaches it

Related terms

ClosureAdjacency list