Trait SystemWork

Source
pub trait SystemWork:
    Sync
    + Send
    + 'static {
    type Data;

    // Required methods
    fn init(&self, index: usize) -> Self::Data;
    fn work(&self, data: &mut Self::Data) -> Decision;

    // Provided method
    fn close(&self, _: Self::Data) { ... }
}
Expand description

A subset of System that can perform work, but my not provide scale. Should be implemented by the user or created by functions such as func_worker.

Required Associated Types§

Source

type Data

Per-worker data. See System::Data.

Required Methods§

Source

fn init(&self, index: usize) -> Self::Data

Create a new worker. See System::init.

Source

fn work(&self, data: &mut Self::Data) -> Decision

Do a unit of work, and return scheduling information. See System::work.

Provided Methods§

Source

fn close(&self, _: Self::Data)

Consume a closed worker. See System::close.

Implementors§

Source§

impl<T> SystemWork for T
where T: System,

Source§

type Data = <T as System>::Data