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§
Required Methods§
sourcefn init(init: Self::Init, sender: ComponentSender<Self>) -> Self
fn init(init: Self::Init, sender: ComponentSender<Self>) -> Self
Defines the initial state of the worker.
sourcefn update(&mut self, message: Self::Input, sender: ComponentSender<Self>)
fn update(&mut self, message: Self::Input, sender: ComponentSender<Self>)
Defines how inputs will bep processed