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 BinaryBenchmarks
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 BinaryBenchmarks at once
Trait Implementations§
Source§impl Clone for BinaryBenchmarkGroup
impl Clone for BinaryBenchmarkGroup
Source§fn clone(&self) -> BinaryBenchmarkGroup
fn clone(&self) -> BinaryBenchmarkGroup
Returns a duplicate 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