Module shadow_rs::utility::counter

source ·
Expand description

A counter that can be used to count frequencies of a set of objects. The counter starts with no keys. When an unknown key is incremented, the counter adds a new key to an internal map and sets the count for that key to 1. When a known key is incremented, the count for that key increases. The state of the counter can be extracted by converting it to a string, which lists the counts for all keys sorted with the heaviest hitters first. Currently, only String types are supported, but we may eventually support counting generic types.

Structs§

  • The main counter object that maps individual keys to count values.