devtools::actor

Trait Actor

Source
pub(crate) trait Actor: Any + ActorAsAny {
    // Required methods
    fn handle_message(
        &self,
        registry: &ActorRegistry,
        msg_type: &str,
        msg: &Map<String, Value>,
        stream: &mut TcpStream,
        stream_id: StreamId,
    ) -> Result<ActorMessageStatus, ()>;
    fn name(&self) -> String;

    // Provided method
    fn cleanup(&self, _id: StreamId) { ... }
}
Expand description

A common trait for all devtools actors that encompasses an immutable name and the ability to process messages that are directed to particular actors. TODO: ensure the name is immutable

Required Methods§

Source

fn handle_message( &self, registry: &ActorRegistry, msg_type: &str, msg: &Map<String, Value>, stream: &mut TcpStream, stream_id: StreamId, ) -> Result<ActorMessageStatus, ()>

Source

fn name(&self) -> String

Provided Methods§

Source

fn cleanup(&self, _id: StreamId)

Implementors§