pub struct BenchProducer<F>where
F: Fn() -> BenchmarkResult,{ /* private fields */ }Expand description
Producer wrapper that runs a benchmark and emits a single-check
Report via Producer::produce.
§Example
use dev_bench::{Benchmark, BenchProducer, Threshold};
use dev_report::Producer;
fn run_bench() -> dev_bench::BenchmarkResult {
let mut b = Benchmark::new("hot_path");
for _ in 0..10 { b.iter(|| std::hint::black_box(1 + 1)); }
b.finish()
}
let producer = BenchProducer::new(run_bench, "0.1.0", None, Threshold::regression_pct(10.0));
let report = producer.produce();
assert_eq!(report.checks.len(), 1);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for BenchProducer<F>where
F: Freeze,
impl<F> RefUnwindSafe for BenchProducer<F>where
F: RefUnwindSafe,
impl<F> Send for BenchProducer<F>where
F: Send,
impl<F> Sync for BenchProducer<F>where
F: Sync,
impl<F> Unpin for BenchProducer<F>where
F: Unpin,
impl<F> UnsafeUnpin for BenchProducer<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for BenchProducer<F>where
F: UnwindSafe,
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
Mutably borrows from an owned value. Read more