pub struct CounterMap { /* private fields */ }Expand description
A map that counts occurrences of string keys.
Implementations§
Source§impl CounterMap
impl CounterMap
pub fn new() -> Self
pub fn increment(&mut self, key: &str) -> u64
pub fn decrement(&mut self, key: &str) -> u64
pub fn get(&self, key: &str) -> u64
pub fn set(&mut self, key: &str, count: u64)
pub fn total(&self) -> u64
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn max_key(&self) -> Option<&str>
pub fn min_key(&self) -> Option<&str>
pub fn remove(&mut self, key: &str) -> Option<u64>
pub fn clear(&mut self)
pub fn keys(&self) -> Vec<&str>
Trait Implementations§
Source§impl Clone for CounterMap
impl Clone for CounterMap
Source§fn clone(&self) -> CounterMap
fn clone(&self) -> CounterMap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CounterMap
impl Debug for CounterMap
Auto Trait Implementations§
impl Freeze for CounterMap
impl RefUnwindSafe for CounterMap
impl Send for CounterMap
impl Sync for CounterMap
impl Unpin for CounterMap
impl UnsafeUnpin for CounterMap
impl UnwindSafe for CounterMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more