Skip to main content

Scheduler

Trait Scheduler 

Source
pub trait Scheduler:
    WithWorkInputOutput
    + WithWorkContextProvider
    + Send
    + Sync {
    type DelayedWorkFactory: DelayedWorkFactory<Self::Tick, Self::WorkContextProvider>;
    type RepeatedWorkFactory: RepeatedTaskFactory<Self::Tick, Self::WorkContextProvider>;
    type ContinuousWorkFactory: ContinuousTaskFactory<Self::Tick, Self::WorkContextProvider>;
    type ImmediateWorkFactory: ImmediateTaskFactory<Self::Tick, Self::WorkContextProvider>;
    type InvokedWorkFactory: InvokedTaskFactory<Self::Tick, Self::WorkContextProvider>;

    // Required methods
    fn schedule_work<W>(&mut self, work: W, cancellation_id: WorkCancellationId)
       where W: 'static + ScheduledWork<Tick = Self::Tick, WorkContextProvider = Self::WorkContextProvider> + Send + Sync;
    fn schedule_invoked_work<W>(&mut self, work: W, invoke_id: WorkInvokeId)
       where W: 'static + ScheduledWork<Tick = Self::Tick, WorkContextProvider = Self::WorkContextProvider> + Send + Sync;
    fn cancel(&mut self, cancellation_id: WorkCancellationId);
    fn invoke(&mut self, invoke_id: WorkInvokeId);
    fn cancel_invoked(&mut self, invoke_id: WorkInvokeId);
    fn generate_cancellation_id(&mut self) -> WorkCancellationId;
    fn generate_invoke_id(&mut self) -> WorkInvokeId;
}
Expand description

Schedulers define a set of work that can be sent to the scheduler to then be executed by its executor, and cancelled when no longer needed.

Required Associated Types§

Required Methods§

Source

fn schedule_work<W>(&mut self, work: W, cancellation_id: WorkCancellationId)
where W: 'static + ScheduledWork<Tick = Self::Tick, WorkContextProvider = Self::WorkContextProvider> + Send + Sync,

Source

fn schedule_invoked_work<W>(&mut self, work: W, invoke_id: WorkInvokeId)
where W: 'static + ScheduledWork<Tick = Self::Tick, WorkContextProvider = Self::WorkContextProvider> + Send + Sync,

Source

fn cancel(&mut self, cancellation_id: WorkCancellationId)

Source

fn invoke(&mut self, invoke_id: WorkInvokeId)

Source

fn cancel_invoked(&mut self, invoke_id: WorkInvokeId)

Source

fn generate_cancellation_id(&mut self) -> WorkCancellationId

Source

fn generate_invoke_id(&mut self) -> WorkInvokeId

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§