Event

Trait Event 

Source
pub trait Event {
    // Required methods
    fn to_bytes(&self) -> Result<Vec<u8>, EngineError>;
    fn from_bytes(bytes: Vec<u8>) -> Result<Self, Box<dyn Error>>
       where Self: Sized;

    // Provided method
    fn send(&self, pub_socket: &mut Socket) -> Result<(), EngineError> { ... }
}
Expand description

Public API for defining events in an application. Events are typed messages that can be sent over a ZMQ socket. Event are equipped with functions to

Required Methods§

Source

fn to_bytes(&self) -> Result<Vec<u8>, EngineError>

convert the event to a raw byte array

Source

fn from_bytes(bytes: Vec<u8>) -> Result<Self, Box<dyn Error>>
where Self: Sized,

Provided Methods§

Source

fn send(&self, pub_socket: &mut Socket) -> Result<(), EngineError>

send an event message to all subscribers

Implementors§