Skip to content

Glossary: Coding Interviews in Rust

entry / or_insert

Also written: entry, or_insert, *counts.entry(key).or_insert(0) += 1

A `HashMap` method pair that finds a key's slot, or starts it at a default such as 0. It is the usual way to count items in Rust.

Where the book teaches it

Related terms

Hash map lookup and countingBTreeMap