[−][src]Struct counters::Table
Helper to print counters as a table in csv format.
Example
use counters::*; let counters = Counters::new(); let table = Table::new(&["foo", "bar", "meh"]); for _ in 0..5 { counters.event("bar"); } counters.event("foo"); // "baz" isn't in the table labels, it will be ignored. counters.event("baz"); table.add_row(&counters); // Start a second row... counters.reset_all(); counters.event("foo"); table.add_row(&counters); // This prints the following to stdout: // foo,bar,meh // 1,5,0 // 1,0,0 table.print_to_stdout();
Methods
impl Table
[src]
pub fn new(label_slice: &[&'static str]) -> Self
[src]
pub fn add_row(&self, row: &Counters) -> usize
[src]
Add collected counters as a row, preserving only the counters that match this table's labels.
pub fn print(&self, to: &mut dyn Write) -> Result<()>
[src]
Print in csv format to an io stream.
pub fn print_to_stdout(&self)
[src]
Print in csv format to stdout.
Trait Implementations
impl Clone for Table
[src]
fn clone(&self) -> Table
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Table
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
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>,