Struct diol::Bench

source ·
pub struct Bench {
    pub config: BenchConfig,
    pub groups: Vec<(Vec<(String, Box<dyn Register<Box<dyn Arg>>>)>, (TypeId, Vec<Box<dyn Arg>>))>,
}
Expand description

main benchmark entry point, used to register functions and arguments, then run benchmarks.

Fields§

§config: BenchConfig§groups: Vec<(Vec<(String, Box<dyn Register<Box<dyn Arg>>>)>, (TypeId, Vec<Box<dyn Arg>>))>

Implementations§

source§

impl Bench

source

pub fn new(config: impl AsRef<BenchConfig>) -> Self

create a bench object from the given configuration.

source

pub fn register_many<T: Arg>( &mut self, f: impl RegisterMany<T>, args: impl IntoIterator<Item = T> )

register multiple functions that should be compared against each other during benchmarking, all taking the same arguments.

source

pub fn register<T: Arg>( &mut self, f: impl Register<T>, args: impl IntoIterator<Item = T> )

register a function for benchmarking, and the arguments that should be passed to it.

source

pub fn run(&mut self) -> Result<BenchResult>

run the benchmark, and write the results to stdout, and optionally to a file, depending on the configuration options.

Auto Trait Implementations§

§

impl Freeze for Bench

§

impl !RefUnwindSafe for Bench

§

impl !Send for Bench

§

impl !Sync for Bench

§

impl Unpin for Bench

§

impl !UnwindSafe for Bench

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