[−][src]Struct counters::Counters
Helper to count events for debugging purposes.
Counters
uses internal mutability to allow updating events without
requiring unique ownership or mutable countexts.
Methods
impl Counters
[src]
pub fn new() -> Self
[src]
pub fn with_capacity(cap: usize) -> Self
[src]
pub fn event(&self, key: &'static str)
[src]
Increment the counter for the provided event key.
pub fn set(&self, key: &'static str, value: u64)
[src]
Set the value of the counter for a given event key.
pub fn reset_event(&self, key: &'static str)
[src]
Reset the counter for the provided event key to zero.
pub fn reset_events<F: Filter>(&self, filter: F)
[src]
Reset some of the counters to zero.
pub fn reset_all(&self)
[src]
Reset all counters to zero.
pub fn retain<F: Filter>(&self, filter: F)
[src]
Keep some of the counters and throw away the rest.
pub fn get(&self, key: &'static str) -> u64
[src]
Get the value of the counter or zero if it does not exist.
pub fn accumulate<F: Filter>(&self, filter: F) -> u64
[src]
Return the sum of all counters with keys containing the provided filter.
pub fn print<F: Filter>(&self, filter: F, to: &mut dyn Write) -> Result<()>
[src]
Print the counters to an io stream.
pub fn print_to_stdout<F: Filter>(&self, filter: F)
[src]
Print the counters to stdout.
pub fn append(&self, other: &Counters)
[src]
Moves all the elements of other
into self
, leaving other
empty.
pub fn apply<F: Filter, Cb: FnMut(&'static str, u64) -> u64>(
&self,
filter: F,
callback: Cb
)
[src]
&self,
filter: F,
callback: Cb
)
Apply a function to all counters matching the provided filter.
Trait Implementations
impl Eq for Counters
[src]
impl PartialEq<Counters> for Counters
[src]
fn eq(&self, _other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Clone for Counters
[src]
fn clone(&self) -> Counters
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Counters
[src]
impl Hash for Counters
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,