TcpConnectionState

Struct TcpConnectionState 

Source
pub struct TcpConnectionState<'a, 'l, M: RawMutex, NETWORK, DNS, const BUFFER_SIZE: usize>
where NETWORK: TcpConnect, DNS: Dns,
{ /* private fields */ }

Implementations§

Source§

impl<'a, 'l, M: RawMutex, NETWORK, DNS, const BUFFER_SIZE: usize> TcpConnectionState<'a, 'l, M, NETWORK, DNS, BUFFER_SIZE>
where NETWORK: TcpConnect, DNS: Dns,

Source

pub fn new( network: &'a NETWORK, dns: DNS, last_will: Option<LastWill<'l>>, config: ClientConfig<'l>, ) -> Self

Trait Implementations§

Source§

impl<'a, 'l, M: RawMutex, NETWORK, DNS, const BUFFER_SIZE: usize> ConnectionState for TcpConnectionState<'a, 'l, M, NETWORK, DNS, BUFFER_SIZE>
where NETWORK: TcpConnect, DNS: Dns,

Source§

fn get_state(&self) -> Option<ConnectionStateValue>

Source§

async fn on_state_change(&self) -> ConnectionStateValue

Source§

async fn disconnect(&self) -> Result<(), MqttError>

Source§

async fn connect(&self) -> Result<(), MqttError>

Establishes the connection to the broker
Source§

async fn await_connected(&self)

Source§

fn set_error(&self)

Source§

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

Send a mqtt packet to the broker This method may return without sending the packet returning Ok(false). This indicates that the send sould be tried later.
Source§

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

Writes a packet to the send buffer and sends data until teh packet fits
Source§

async fn run_io(&self) -> Result<impl Deref<Target = Packet<'_>>, MqttError>

Run pending io tasks until there is a new packet
Source§

async fn run_io_nonblocking( &self, ) -> Result<Option<impl Deref<Target = Packet<'_>>>, MqttError>

Run until there is a new packet or something has been sent

Auto Trait Implementations§

§

impl<'a, 'l, M, NETWORK, DNS, const BUFFER_SIZE: usize> !Freeze for TcpConnectionState<'a, 'l, M, NETWORK, DNS, BUFFER_SIZE>

§

impl<'a, 'l, M, NETWORK, DNS, const BUFFER_SIZE: usize> !RefUnwindSafe for TcpConnectionState<'a, 'l, M, NETWORK, DNS, BUFFER_SIZE>

§

impl<'a, 'l, M, NETWORK, DNS, const BUFFER_SIZE: usize> Send for TcpConnectionState<'a, 'l, M, NETWORK, DNS, BUFFER_SIZE>
where DNS: Send, NETWORK: Sync, M: Send, <NETWORK as TcpConnect>::Connection<'a>: Send,

§

impl<'a, 'l, M, NETWORK, DNS, const BUFFER_SIZE: usize> !Sync for TcpConnectionState<'a, 'l, M, NETWORK, DNS, BUFFER_SIZE>

§

impl<'a, 'l, M, NETWORK, DNS, const BUFFER_SIZE: usize> Unpin for TcpConnectionState<'a, 'l, M, NETWORK, DNS, BUFFER_SIZE>
where DNS: Unpin, M: Unpin, <NETWORK as TcpConnect>::Connection<'a>: Unpin,

§

impl<'a, 'l, M, NETWORK, DNS, const BUFFER_SIZE: usize> UnwindSafe for TcpConnectionState<'a, 'l, M, NETWORK, DNS, BUFFER_SIZE>
where DNS: UnwindSafe, NETWORK: RefUnwindSafe, M: UnwindSafe, <NETWORK as TcpConnect>::Connection<'a>: UnwindSafe,

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.