benchplot

Struct BenchBuilder

Source
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>

Source

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.

Source

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.

Source

pub fn parallel(self, parallel: bool) -> Self

Sets whether to run (input size, function) pair benchmarks in parallel.

Default: false.

Source

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.

Source

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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>,

Source§

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.