Rust 1.99 (2024 edition) reference · 4 entries

Rust Vec and HashMap

Grow, sort, search and filter vectors, and insert, update, look up and iterate maps.

NameDescriptionSince
Vec: push, pop, retain, dedup and sort Grow and shrink vectors, remove items by condition, deduplicate, and sort, including by key or float values.
slice contains, iter().position and binary_search Search slices: membership, the index of a match, the first matching item, or a binary search in sorted data.
HashMap::entry Insert or update a map value in one lookup: count occurrences, append to lists, or insert a default if missing.
HashMap get, insert, remove and iteration Look up, add and remove map entries, and iterate in a deterministic order by sorting keys or using BTreeMap.

Was this page helpful?