Skip to main content

DeliveryService

Trait DeliveryService 

Source
pub trait DeliveryService:
    Send
    + Sync
    + 'static {
    // Required methods
    fn send(&self, pkt: OutboundPacket) -> Result<String, DeliveryServiceError>;
    fn subscribe(&self) -> Receiver<InboundPacket>;
}

Required Methods§

Source

fn send(&self, pkt: OutboundPacket) -> Result<String, DeliveryServiceError>

Send a packet to the network and return a transport message id (if available).

Source

fn subscribe(&self) -> Receiver<InboundPacket>

Subscribe to inbound packets.

Each call creates a new channel and registers its sender internally. Senders are pruned when the corresponding receiver is dropped, but only during the next inbound event dispatch. Avoid calling this in a loop without dropping previous receivers.

Implementors§