pub trait Worker: Sized + Send + 'static {
    type Init: 'static + Send;
    type Input: 'static + Send + Debug;
    type Output: 'static + Send + Debug;

    // Required methods
    fn init(init: Self::Init, sender: ComponentSender<Self>) -> Self;
    fn update(&mut self, message: Self::Input, sender: ComponentSender<Self>);
}
Expand description

Receives inputs and outputs in the background.

Required Associated Types§

source

type Init: 'static + Send

The initial parameters that will be used to build the worker state.

source

type Input: 'static + Send + Debug

The type of inputs that this worker shall receive.

source

type Output: 'static + Send + Debug

The type of outputs that this worker shall send.

Required Methods§

source

fn init(init: Self::Init, sender: ComponentSender<Self>) -> Self

Defines the initial state of the worker.

source

fn update(&mut self, message: Self::Input, sender: ComponentSender<Self>)

Defines how inputs will bep processed

Implementors§