[][src]Macro iai::main

macro_rules! main {
    ( $( $func_name:ident ),+ $(,)* ) => { ... };
}

Macro which expands to a benchmark harness.

Currently, using Iai requires disabling the benchmark harness generated automatically by rustc. This can be done like so:

[[bench]]
name = "my_bench"
harness = false

In this case, my_bench must be a rust file inside the 'benches' directory, like so:

benches/my_bench.rs

Since we've disabled the default benchmark harness, we need to add our own:

fn bench_method1() {
}

fn bench_method2() {
}

iai::main!(bench_method1, bench_method2);

The iai::main macro expands to a main function which runs all of the benchmarks in the given groups.