Trait HostConnection

Source
pub trait HostConnection: Sized + Send {
    // Required methods
    fn open(
        &mut self,
        address: String,
        username: String,
        password: String,
        keep_alive_interval_in_secs: u64,
    ) -> impl Future<Output = Result<Resource<Connection>, Error>> + Send;
    fn publish(
        &mut self,
        self_: Resource<Connection>,
        topic: String,
        payload: Payload,
        qos: Qos,
    ) -> impl Future<Output = Result<(), Error>> + Send;
    fn drop(
        &mut self,
        rep: Resource<Connection>,
    ) -> impl Future<Output = Result<()>> + Send;
}

Required Methods§

Source

fn open( &mut self, address: String, username: String, password: String, keep_alive_interval_in_secs: u64, ) -> impl Future<Output = Result<Resource<Connection>, Error>> + Send

Open a connection to the Mqtt instance at address.

Source

fn publish( &mut self, self_: Resource<Connection>, topic: String, payload: Payload, qos: Qos, ) -> impl Future<Output = Result<(), Error>> + Send

Publish an Mqtt message to the specified topic.

Source

fn drop( &mut self, rep: Resource<Connection>, ) -> impl Future<Output = Result<()>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<_T: HostConnection + ?Sized + Send> HostConnection for &mut _T

Source§

async fn open( &mut self, address: String, username: String, password: String, keep_alive_interval_in_secs: u64, ) -> Result<Resource<Connection>, Error>

Open a connection to the Mqtt instance at address.

Source§

async fn publish( &mut self, self_: Resource<Connection>, topic: String, payload: Payload, qos: Qos, ) -> Result<(), Error>

Publish an Mqtt message to the specified topic.

Source§

async fn drop(&mut self, rep: Resource<Connection>) -> Result<()>

Implementors§