Struct brunch::Bench [−][src]
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]
S: AsRef<str>,
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]
F: FnMut() -> O,
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]
F: FnMut(I) -> O,
I: Clone,
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]
F: FnMut(&I) -> O,
I: Clone,
With Callback.
Run a benchmark that takes a value by reference.
Auto Trait Implementations
impl RefUnwindSafe for Bench
[src]
impl Send for Bench
[src]
impl Sync for Bench
[src]
impl Unpin for Bench
[src]
impl UnwindSafe for Bench
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,