pub struct CounterTable<T, C> {
pub columns: BTreeMap<C, Column>,
pub rows: RwLock<BTreeMap<T, BTreeMap<C, u32>>>,
}
Fields§
§columns: BTreeMap<C, Column>
§rows: RwLock<BTreeMap<T, BTreeMap<C, u32>>>
Implementations§
Source§impl<T, C> CounterTable<T, C>
impl<T, C> CounterTable<T, C>
Sourcepub fn with_columns(self, columns: Vec<(C, &'static str, bool)>) -> Self
pub fn with_columns(self, columns: Vec<(C, &'static str, bool)>) -> Self
builder pattern to add columns
Sourcepub fn remove_row(&self, row_id: &T)
pub fn remove_row(&self, row_id: &T)
remove counter row
Sourcepub fn inc_counter(&self, row_id: &T, column_id: C)
pub fn inc_counter(&self, row_id: &T, column_id: C)
increment counter
Sourcepub fn set_counter(&self, row_id: &T, column_id: C, val: u32)
pub fn set_counter(&self, row_id: &T, column_id: C, val: u32)
set counter
Sourcepub fn reset_counters(&self)
pub fn reset_counters(&self)
reset all counters
Sourcepub fn header_fmt(&self) -> String
pub fn header_fmt(&self) -> String
column headers in string format (center justified, min 10 spaces)
Sourcepub fn values_fmt(&self, row_id: T) -> String
pub fn values_fmt(&self, row_id: T) -> String
format values in string format (center justified to column header - min 10 spaces)
Trait Implementations§
Source§impl<T, C> Default for CounterTable<T, C>
impl<T, C> Default for CounterTable<T, C>
Source§impl<T, C> PartialEq for CounterTable<T, C>
impl<T, C> PartialEq for CounterTable<T, C>
Auto Trait Implementations§
impl<T, C> !Freeze for CounterTable<T, C>
impl<T, C> RefUnwindSafe for CounterTable<T, C>where
C: RefUnwindSafe,
impl<T, C> Send for CounterTable<T, C>
impl<T, C> Sync for CounterTable<T, C>
impl<T, C> Unpin for CounterTable<T, C>
impl<T, C> UnwindSafe for CounterTable<T, C>where
C: RefUnwindSafe,
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