Trait sans_io_runtime::Task

source ·
pub trait Task<In, Out>: TaskSwitcherChild<Out> {
    // Required methods
    fn on_tick(&mut self, now: Instant);
    fn on_event(&mut self, now: Instant, input: In);
    fn on_shutdown(&mut self, now: Instant);
}
Expand description

Represents a task.

Required Methods§

source

fn on_tick(&mut self, now: Instant)

Called each time the task is ticked. Default is 1ms.

source

fn on_event(&mut self, now: Instant, input: In)

Called when an input event is received for the task.

source

fn on_shutdown(&mut self, now: Instant)

Gracefully shuts down the task.

Implementors§