Client

Struct Client 

Source
pub struct Client<'a, 'b, const L: usize> { /* private fields */ }
Expand description

MQTT Client

This client is meerly a convenience wrapper around a heapless::spsc::Producer, making it easier to send certain MQTT packet types, and maintaining a common reference to a client id. Also it implements the Mqtt trait.

Lifetimes:

  • ’a: The lifetime of the queue exhanging packets between the client and the event loop. This must have the same lifetime as the corresponding Consumer. Usually ’static.
  • ’b: The lifetime of client id str

Generics:

  • L: The length of the queue, exhanging packets between the client and the event loop. Length in number of request packets

Implementations§

Source§

impl<'a, 'b, const L: usize> Client<'a, 'b, L>

Source

pub fn new(producer: FrameProducer<'a, L>, client_id: &'b str) -> Self

Trait Implementations§

Source§

impl<'a, 'b, const L: usize> Mqtt for Client<'a, 'b, L>

Source§

fn client_id(&self) -> &str

Source§

fn send(&self, packet: Packet<'_>) -> Result<(), MqttError>

Source§

fn publish( &self, topic_name: &str, payload: &[u8], qos: QoS, ) -> Result<(), MqttError>

Source§

fn subscribe(&self, topics: &[SubscribeTopic<'_>]) -> Result<(), MqttError>

Source§

fn unsubscribe(&self, topics: &[&str]) -> Result<(), MqttError>

Auto Trait Implementations§

§

impl<'a, 'b, const L: usize> !Freeze for Client<'a, 'b, L>

§

impl<'a, 'b, const L: usize> !RefUnwindSafe for Client<'a, 'b, L>

§

impl<'a, 'b, const L: usize> Send for Client<'a, 'b, L>

§

impl<'a, 'b, const L: usize> !Sync for Client<'a, 'b, L>

§

impl<'a, 'b, const L: usize> Unpin for Client<'a, 'b, L>

§

impl<'a, 'b, const L: usize> !UnwindSafe for Client<'a, 'b, L>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.