pub trait Process<T: Send + 'static>{
// Required method
fn handle(
&mut self,
message: T,
tx: &Sender<T>,
) -> impl Future<Output = T> + Send;
// Provided methods
fn spawn(self) -> impl Future<Output = ProcessInfo<T>> + Send { ... }
fn run(
&mut self,
tx: &Sender<T>,
rx: &mut Receiver<T>,
) -> impl Future<Output = ()> + Send { ... }
fn main_loop(
&mut self,
tx: &Sender<T>,
rx: &mut Receiver<T>,
) -> impl Future<Output = ()> + Send { ... }
fn should_stop(&self) -> bool { ... }
fn init(&mut self, _tx: &Sender<T>) -> impl Future<Output = ()> + Send { ... }
fn receive(
&mut self,
tx: &Sender<T>,
rx: &mut Receiver<T>,
) -> impl Future<Output = T> + Send { ... }
}Required Methods§
Provided Methods§
fn spawn(self) -> impl Future<Output = ProcessInfo<T>> + Send
fn run( &mut self, tx: &Sender<T>, rx: &mut Receiver<T>, ) -> impl Future<Output = ()> + Send
fn main_loop( &mut self, tx: &Sender<T>, rx: &mut Receiver<T>, ) -> impl Future<Output = ()> + Send
fn should_stop(&self) -> bool
fn init(&mut self, _tx: &Sender<T>) -> impl Future<Output = ()> + Send
fn receive( &mut self, tx: &Sender<T>, rx: &mut Receiver<T>, ) -> impl Future<Output = T> + Send
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.