macro_rules! bench {
($name:ident, $fn:expr) => { ... };
}Expand description
Declare a benchmark function.
If cfg(benchmark) is enabled, a function named name is emitted and it
receives RealBencher.
If cfg(test) is enabled, a module named name with a single test called
test_bench is emitted and it receives TestBencher.
This setup allows for all benchmarking functions to run in unit test mode, allowing problems to be noticed sooner.
Note that $fn doesn’t have to be a named function - it can also be an
anonymous closure.