Skip to main content

PollWork

Trait PollWork 

Source
pub trait PollWork:
    Clone
    + Send
    + Sync
    + 'static {
    type State: Send + 'static;

    // Required methods
    fn init(&self) -> impl Future<Output = Self::State> + Send;
    fn poll(
        &self,
        task_id: u64,
        state: &mut Self::State,
    ) -> impl Future<Output = PollResult> + Send;

    // Provided method
    fn cleanup(&self, _state: Self::State) -> impl Future<Output = ()> + Send { ... }
}
Expand description

Worker lifecycle for the poll side of an async-task benchmark.

Required Associated Types§

Source

type State: Send + 'static

Per-worker state.

Required Methods§

Source

fn init(&self) -> impl Future<Output = Self::State> + Send

Source

fn poll( &self, task_id: u64, state: &mut Self::State, ) -> impl Future<Output = PollResult> + Send

Check a task for completion.

Provided Methods§

Source

fn cleanup(&self, _state: Self::State) -> impl Future<Output = ()> + Send

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§