Processor

Trait Processor 

Source
pub trait Processor<M>:
    Sized
    + Send
    + 'static
where M: ControlMessage,
{ // Required methods fn start(self, finished: Arc<AtomicBool>) -> (Sender<M>, JoinHandle<()>); fn handle_control_messages( &mut self, rx: &Receiver<M>, ) -> Result<ProcessorState>; }

Required Methods§

Source

fn start(self, finished: Arc<AtomicBool>) -> (Sender<M>, JoinHandle<()>)

Source

fn handle_control_messages( &mut self, rx: &Receiver<M>, ) -> Result<ProcessorState>

Handle control messages, if any are ready.

When receiving messages, be sure to use rx.try_recv() to ensure this method does not block when no control messages are available.

If a shutdown message is received, return Ok(ProcessorState::Finished). Otherwise return Ok(ProcessorState::Running). If fatal unexpected errors occur, return the error.

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.

Implementors§