[go: up one dir, main page]

IntoCounter

Trait IntoCounter 

Source
pub trait IntoCounter {
    type Counter: Counter;

    // Required method
    fn into_counter(self) -> Self::Counter;
}
Expand description

Conversion into a Counter.

§Examples

This trait is implemented for unsigned integers over ItemsCount:

#[divan::bench]
fn sort_values(bencher: divan::Bencher) {
    let mut values: Vec<T> = // ...
    bencher
        .counter(values.len())
        .bench_local(|| {
            divan::black_box(&mut values).sort();
        });
}

Required Associated Types§

Source

type Counter: Counter

Which kind of counter are we turning this into?

Required Methods§

Source

fn into_counter(self) -> Self::Counter

Converts into a Counter.

Implementations on Foreign Types§

Source§

impl IntoCounter for u8

Source§

impl IntoCounter for u16

Source§

impl IntoCounter for u32

Source§

impl IntoCounter for u64

Source§

impl IntoCounter for usize

Implementors§