pub struct Client { /* private fields */ }
Expand description
Channel based MQTT client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(options: CreateOptions, config: ClientConfig) -> Result<Self, Error>
pub fn new(options: CreateOptions, config: ClientConfig) -> Result<Self, Error>
Create a new client using the supplied options.
Sourcepub fn tx_channel(&self) -> Sender<Event>
pub fn tx_channel(&self) -> Sender<Event>
Get a sending channel for sending events to the client.
Sourcepub fn rx_channel(&self) -> Receiver<Event>
pub fn rx_channel(&self) -> Receiver<Event>
Get a receiving channel for consuming events from the client.
Sourcepub fn subscribe(&self, subscription: Subscription)
pub fn subscribe(&self, subscription: Subscription)
Add a new subscription.
If the client is currently connected then the subscription takes effect for the connected session.
In all cases the subscription is added to the cache to be subscribed on reconnect.
Sourcepub async fn start(&self, options: ConnectOptions) -> Result<()>
pub async fn start(&self, options: ConnectOptions) -> Result<()>
Start the client using the supplied connection options.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more