January 2019
Intermediate to advanced
520 pages
14h 32m
English
Create the QueueHandler struct in the queue_actor.rs file:
pub trait QueueHandler: 'static { type Incoming: for<'de> Deserialize<'de>; type Outgoing: Serialize; fn incoming(&self) -> &str; fn outgoing(&self) -> &str; fn handle( &self, id: &TaskId, incoming: Self::Incoming, ) -> Result<Option<Self::Outgoing>, Error>; }
QueueHandler is a trait that has two associated types and three methods. It requires a static lifetime for types that will implement the QueueHandler trait, because instances of this trait will be used as fields of actors that have a static lifetime as well.
This trait has the Incoming associated type, which represents the incoming message type and requires the type to implement the Deserialize trait ...
Read now
Unlock full access