Benchmark

Trait Benchmark 

Source
pub trait Benchmark: Plugin {
    // Required methods
    fn descriptor(&self) -> &'static BenchmarkDescriptor;
    fn parameters(&self) -> Vec<ParamSpec>;
    fn configure(&mut self, values: &ParamValues) -> Result<()>;
    fn next(&mut self) -> impl Future<Output = Result<BenchmarkResult>> + Send;

    // Provided methods
    fn run(&mut self) -> impl Stream<Item = Result<BenchmarkResult>> + '_
       where Self: Sized + Send { ... }
    fn cleanup(&mut self) -> impl Future<Output = Result<()>> + Send { ... }
}

Required Methods§

Source

fn descriptor(&self) -> &'static BenchmarkDescriptor

Source

fn parameters(&self) -> Vec<ParamSpec>

2026-09-26: The parameters shown before the run starts, so the user can change them. Their defaults are in the returned specs.

Source

fn configure(&mut self, values: &ParamValues) -> Result<()>

2026-09-26: Receive the edited values. Validate here and return an error naming the offending field; the executor calls next() only after this returns Ok.

Source

fn next(&mut self) -> impl Future<Output = Result<BenchmarkResult>> + Send

2026-09-26: One step of work, returning the frame for that step.

Provided Methods§

Source

fn run(&mut self) -> impl Stream<Item = Result<BenchmarkResult>> + '_
where Self: Sized + Send,

2026-09-26: Drive next() to completion, streaming every frame. The stream ends after the first terminal crate::RunStatus, or after an error. It does not call cleanup().

Source

fn cleanup(&mut self) -> impl Future<Output = Result<()>> + Send

2026-09-26: Release whatever the run acquired. The executor calls it once on every return path of a run: completion, failure, cancellation, a failed setup and a refused hardware precheck.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§