pub struct Counter<T: Eq + Hash + Copy + PartialOrd + PartialEq> { /* private fields */ }Implementations§
Source§impl<T: Eq + Hash + Copy + PartialOrd + PartialEq> Counter<T>
impl<T: Eq + Hash + Copy + PartialOrd + PartialEq> Counter<T>
pub fn new() -> Self
pub fn from(self, iterable: impl IntoIterator<Item = T> + Clone) -> Counter<T>
pub fn get(&self, key: T) -> Option<usize>
pub fn update(&mut self, key: T, count: usize)
pub fn elements(&self) -> impl IntoIterator<Item = T>
pub fn iter(&self) -> impl Iterator<Item = (&T, &usize)>
pub fn most_common(&self, n: usize) -> Vec<(&T, &usize)>
pub fn substract(&self, other: &Self) -> Counter<T>
pub fn total(&self) -> usize
pub fn clear(&mut self)
Trait Implementations§
impl<T: Eq + Eq + Hash + Copy + PartialOrd + PartialEq> Eq for Counter<T>
impl<T: Eq + Hash + Copy + PartialOrd + PartialEq> StructuralPartialEq for Counter<T>
Auto Trait Implementations§
impl<T> Freeze for Counter<T>
impl<T> RefUnwindSafe for Counter<T>where
T: RefUnwindSafe,
impl<T> Send for Counter<T>where
T: Send,
impl<T> Sync for Counter<T>where
T: Sync,
impl<T> Unpin for Counter<T>where
T: Unpin,
impl<T> UnwindSafe for Counter<T>where
T: UnwindSafe,
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