Struct brunch::Bench[][src]

pub struct Bench { /* fields omitted */ }

Benchmark.

This struct holds a single "bench" you wish to run. See the main crate documentation for more information.

Implementations

impl Bench[src]

pub fn new<S>(namespace: S, name: S) -> Self where
    S: AsRef<str>, 
[src]

New.

Instantiate a new benchmark with a namespace and name. These values — i.e. namespace::name — should be unique for each specific benchmark or historical comparisons will be muffed.

#[must_use]pub const fn timed(self, time: Duration) -> Self[src]

Set Time Limit.

By default, benches will run for around 3 seconds. This value can be increased for slow benchmarks, or decreased for fast ones, as needed.

Note: this must be called before supplying a callback or it will not apply.

pub fn with<F, O>(self, cb: F) -> Self where
    F: FnMut() -> O, 
[src]

With Callback.

Run a benchmark that does not take any arguments.

Examples

use brunch::Bench;
use dactyl::NiceU8;
use std::time::Duration;

brunch::benches!(
Bench::new("dactyl::NiceU8", "from(0)")
    .timed(Duration::from_secs(1))
    .with(|| NiceU8::from(0_u8))
);

pub fn with_setup<F, I, O>(self, env: I, cb: F) -> Self where
    F: FnMut(I) -> O,
    I: Clone
[src]

With Callback.

Run a benchmark that takes a value by value.

pub fn with_setup_ref<F, I, O>(self, env: I, cb: F) -> Self where
    F: FnMut(&I) -> O,
    I: Clone
[src]

With Callback.

Run a benchmark that takes a value by reference.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.