pub struct StressProducer<F>where
F: Fn() -> StressResult,{ /* private fields */ }Expand description
Producer wrapper that runs a stress run and emits a single-check Report.
§Example
use dev_stress::{CompareOptions, StressProducer, StressRun, Workload};
use dev_report::Producer;
#[derive(Clone)]
struct Noop;
impl Workload for Noop { fn run_once(&self) {} }
let producer = StressProducer::new(
|| StressRun::new("hot").iterations(1_000).threads(2).execute(&Noop),
"0.1.0",
CompareOptions::default(),
);
let report = producer.produce();
assert_eq!(report.checks.len(), 1);Implementations§
Source§impl<F> StressProducer<F>where
F: Fn() -> StressResult,
impl<F> StressProducer<F>where
F: Fn() -> StressResult,
Sourcepub fn new(
run: F,
subject_version: impl Into<String>,
opts: CompareOptions,
) -> Self
pub fn new( run: F, subject_version: impl Into<String>, opts: CompareOptions, ) -> Self
Build a new producer.
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for StressProducer<F>where
F: Freeze,
impl<F> RefUnwindSafe for StressProducer<F>where
F: RefUnwindSafe,
impl<F> Send for StressProducer<F>where
F: Send,
impl<F> Sync for StressProducer<F>where
F: Sync,
impl<F> Unpin for StressProducer<F>where
F: Unpin,
impl<F> UnsafeUnpin for StressProducer<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for StressProducer<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