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§

source§

impl<C: Counter> IntoCounter for C

§

type Counter = C