pub struct BinaryBenchmarkGroup(/* private fields */);
Expand description

The BinaryBenchmarkGroup lets you configure binary benchmark Runs

Implementations§

source§

impl BinaryBenchmarkGroup

source

pub fn bench<T>(&mut self, run: T) -> &mut Self
where T: Into<InternalRun>,

Specify a Run to benchmark a binary

You can specify a crate’s binary either at group level with the simple name of the binary (say my-exe) or at bench level with env!("CARGO_BIN_EXE_my-exe"). See examples.

See also Run for more details.

Examples

If your crate has a binary my-exe (the name key of a [[bin]] entry in Cargo.toml), specifying "my-exe" in the benchmark argument sets the command for all Run arguments and it’s sufficient to specify only Arg with Run::with_arg:

use iai_callgrind::{binary_benchmark_group, Arg, BinaryBenchmarkGroup, Run};

binary_benchmark_group!(
    name = my_exe_group;
    benchmark = |"my-exe", group: &mut BinaryBenchmarkGroup| {
        group.bench(Run::with_arg(Arg::new("foo", &["foo"])));
    }
);

Without the command at group level:

use iai_callgrind::{binary_benchmark_group, Arg, BinaryBenchmarkGroup, Run};

binary_benchmark_group!(
    name = my_exe_group;
    benchmark = |group: &mut BinaryBenchmarkGroup| {
        // Usually you should use `env!("CARGO_BIN_EXE_my-exe")` if `my-exe` is a binary
        // of your crate
        group.bench(Run::with_cmd("/path/to/my-exe", Arg::new("foo", &["foo"])));
    }
);

Trait Implementations§

source§

impl AsRef<BinaryBenchmarkGroup> for BinaryBenchmarkGroup

source§

fn as_ref(&self) -> &BinaryBenchmarkGroup

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for BinaryBenchmarkGroup

source§

fn clone(&self) -> BinaryBenchmarkGroup

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BinaryBenchmarkGroup

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for BinaryBenchmarkGroup

source§

fn default() -> BinaryBenchmarkGroup

Returns the “default value” for a type. Read more
source§

impl From<&BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup

source§

fn from(value: &BinaryBenchmarkGroup) -> Self

Converts to this type from the input type.
source§

impl From<&mut BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup

source§

fn from(value: &mut BinaryBenchmarkGroup) -> Self

Converts to this type from the input type.
source§

impl From<BinaryBenchmarkGroup> for BinaryBenchmarkGroup

source§

fn from(value: InternalBinaryBenchmarkGroup) -> Self

Converts to this type from the input type.
source§

impl From<BinaryBenchmarkGroup> for InternalBinaryBenchmarkGroup

source§

fn from(value: BinaryBenchmarkGroup) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.