Trait Publisher

pub trait Publisher: Send + Sync {
    // Required methods
    fn publish_text(&self, topic: &str, content: &str) -> Result<(), NerveError>;
    fn publish_binary(&self, topic: &str, data: &[u8]) -> Result<(), NerveError>;
    fn publish_structured(
        &self,
        topic: &str,
        value: Value,
    ) -> Result<(), NerveError>;
    fn publish_control(
        &self,
        topic: &str,
        command: &str,
        parameters: Value,
    ) -> Result<(), NerveError>;
    fn statistics(&self) -> PublishingStatistics;
}
Expand description

Publisher interface

Required Methods§

fn publish_text(&self, topic: &str, content: &str) -> Result<(), NerveError>

Publish a text message

fn publish_binary(&self, topic: &str, data: &[u8]) -> Result<(), NerveError>

Publish a binary message

fn publish_structured( &self, topic: &str, value: Value, ) -> Result<(), NerveError>

Publish a structured message

fn publish_control( &self, topic: &str, command: &str, parameters: Value, ) -> Result<(), NerveError>

Publish a control message

fn statistics(&self) -> PublishingStatistics

Get publishing statistics

Implementations on Foreign Types§

§

impl Publisher for SimplePubSub

§

fn publish_text(&self, topic: &str, content: &str) -> Result<(), NerveError>

§

fn publish_binary(&self, topic: &str, data: &[u8]) -> Result<(), NerveError>

§

fn publish_structured( &self, topic: &str, value: Value, ) -> Result<(), NerveError>

§

fn publish_control( &self, topic: &str, command: &str, parameters: Value, ) -> Result<(), NerveError>

§

fn statistics(&self) -> PublishingStatistics

Implementors§