pub struct BenchBuilder<'a, T, R> { /* private fields */ }Expand description
Builder for creating a Bench instance.
Implementations§
Source§impl<'a, T, R> BenchBuilder<'a, T, R>
impl<'a, T, R> BenchBuilder<'a, T, R>
Sourcepub fn new(
functions: Vec<BenchFnNamed<'a, T, R>>,
argfunc: BenchFnArg<T>,
sizes: Vec<usize>,
) -> Self
pub fn new( functions: Vec<BenchFnNamed<'a, T, R>>, argfunc: BenchFnArg<T>, sizes: Vec<usize>, ) -> Self
Creates a new BenchBuilder with required parameters.
Mandatory parameters are required upfront and optional parameters are configured through method chaining.
By default, repetitions is set to 1, parallel to false, and
assert_equal to false.
Sourcepub fn repetitions(self, repetitions: usize) -> Self
pub fn repetitions(self, repetitions: usize) -> Self
Sets the number of times to time each (input size, function) pair.
For each (input size, function) pair, the function is timed
repetitions times and the average over the repetitions is used as the
benchmark value.
Default: 1.
Sourcepub fn parallel(self, parallel: bool) -> Self
pub fn parallel(self, parallel: bool) -> Self
Sets whether to run (input size, function) pair benchmarks in parallel.
Default: false.
Sourcepub fn assert_equal(self, assert_equal: bool) -> Self
pub fn assert_equal(self, assert_equal: bool) -> Self
Sets whether to assert that all function return values are equal.
When set to true, if there exists an input size such that the function
return values are not equal, then the program panics.
If repetitions is greater than 1, then for each input size, only the
function return values from the last repetition are compared.
Default: false.
Sourcepub fn build(self) -> Result<Bench<'a, T, R>, BenchBuilderError>
pub fn build(self) -> Result<Bench<'a, T, R>, BenchBuilderError>
Validates the configuration and builds a Bench instance.
Auto Trait Implementations§
impl<'a, T, R> Freeze for BenchBuilder<'a, T, R>
impl<'a, T, R> !RefUnwindSafe for BenchBuilder<'a, T, R>
impl<'a, T, R> Send for BenchBuilder<'a, T, R>
impl<'a, T, R> Sync for BenchBuilder<'a, T, R>
impl<'a, T, R> Unpin for BenchBuilder<'a, T, R>
impl<'a, T, R> !UnwindSafe for BenchBuilder<'a, T, R>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more