pub struct BinaryBenchmarkGroup {
pub binary_benchmarks: Vec<BinaryBenchmark>,
}
Available on crate feature
default
only.Expand description
low level api only: The top level struct to add binary benchmarks to
This struct doesn’t need to be instantiated by yourself. It is passed as mutable reference to
the expression in benchmarks
.
use iai_callgrind::binary_benchmark_group;
binary_benchmark_group!(
name = my_group;
benchmarks = |_group: &mut BinaryBenchmarkGroup| {
// Access the BinaryBenchmarkGroup with the identifier `group` to add benchmarks to the
// group.
//
// group.binary_benchmark(/* BinaryBenchmark::new(...) */);
}
);
Fields§
§binary_benchmarks: Vec<BinaryBenchmark>
All BinaryBenchmark
s
Implementations§
source§impl BinaryBenchmarkGroup
impl BinaryBenchmarkGroup
sourcepub fn binary_benchmark<T>(&mut self, binary_benchmark: T) -> &mut Selfwhere
T: Into<BinaryBenchmark>,
pub fn binary_benchmark<T>(&mut self, binary_benchmark: T) -> &mut Selfwhere
T: Into<BinaryBenchmark>,
Add a BinaryBenchmark
to this group
This can be a binary benchmark created with BinaryBenchmark::new
or a
crate::binary_benchmark
attributed function addable with the
crate::binary_benchmark_attribute
macro.
It is an error to add a BinaryBenchmark
without having added a Bench
to it.
§Examples
Add a BinaryBenchmark
to this group
use iai_callgrind::{binary_benchmark_group, BinaryBenchmark, Bench, BinaryBenchmarkGroup};
fn setup_my_group(group: &mut BinaryBenchmarkGroup) {
group.binary_benchmark(BinaryBenchmark::new("bench_binary")
.bench(Bench::new("foo")
.command(iai_callgrind::Command::new(env!("CARGO_BIN_EXE_my-foo"))
.arg("foo")
)
)
);
}
binary_benchmark_group!(
name = my_group;
benchmarks = |group: &mut BinaryBenchmarkGroup| setup_my_group(group)
);
Or, add a #[binary_benchmark]
annotated function to this group:
use iai_callgrind::{binary_benchmark, binary_benchmark_group, binary_benchmark_attribute};
#[binary_benchmark]
#[bench::foo("foo")]
fn bench_binary(arg: &str) -> iai_callgrind::Command {
iai_callgrind::Command::new(env!("CARGO_BIN_EXE_my-foo"))
.arg(arg)
.build()
}
binary_benchmark_group!(
name = my_group;
benchmarks = |group: &mut BinaryBenchmarkGroup| {
group
.binary_benchmark(binary_benchmark_attribute!(bench_binary))
}
);
sourcepub fn binary_benchmarks<I, T>(&mut self, binary_benchmarks: T) -> &mut Self
pub fn binary_benchmarks<I, T>(&mut self, binary_benchmarks: T) -> &mut Self
Add multiple BinaryBenchmark
s at once
Trait Implementations§
source§impl Clone for BinaryBenchmarkGroup
impl Clone for BinaryBenchmarkGroup
source§fn clone(&self) -> BinaryBenchmarkGroup
fn clone(&self) -> BinaryBenchmarkGroup
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for BinaryBenchmarkGroup
impl Debug for BinaryBenchmarkGroup
source§impl Default for BinaryBenchmarkGroup
impl Default for BinaryBenchmarkGroup
source§fn default() -> BinaryBenchmarkGroup
fn default() -> BinaryBenchmarkGroup
Returns the “default value” for a type. Read more
source§impl PartialEq for BinaryBenchmarkGroup
impl PartialEq for BinaryBenchmarkGroup
impl StructuralPartialEq for BinaryBenchmarkGroup
Auto Trait Implementations§
impl Freeze for BinaryBenchmarkGroup
impl RefUnwindSafe for BinaryBenchmarkGroup
impl Send for BinaryBenchmarkGroup
impl Sync for BinaryBenchmarkGroup
impl Unpin for BinaryBenchmarkGroup
impl UnwindSafe for BinaryBenchmarkGroup
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)