InMemorySession

Struct InMemorySession 

pub struct InMemorySession {
    outgoing_qos1: BTreeMap<PacketId, Qos1Entry>,
    outgoing_qos2: BTreeMap<PacketId, Qos2Entry>,
    incoming_qos2: BTreeSet<PacketId>,
}
Available on crate feature alloc only.
Expand description

In-memory implementation of SessionState.

All state lives on the heap and is lost when the struct is dropped. Suitable for clients that always connect with Clean Start = 1 or that do not need durable session persistence.

Fields§

§outgoing_qos1: BTreeMap<PacketId, Qos1Entry>§outgoing_qos2: BTreeMap<PacketId, Qos2Entry>§incoming_qos2: BTreeSet<PacketId>

Implementations§

§

impl InMemorySession

pub const fn new() -> Self

Create a new, empty in-memory session.

Trait Implementations§

§

impl Default for InMemorySession

§

fn default() -> Self

Returns the “default value” for a type. Read more
§

impl SessionState for InMemorySession

§

fn store_outgoing_qos1( &mut self, packet_id: PacketId, topic: &Topic, payload: &[u8], retain: bool, properties: &PublishProperties, )

Store a QoS 1 outbound publish (PUBLISH sent, awaiting PUBACK). Read more
§

fn remove_outgoing_qos1(&mut self, packet_id: PacketId)

Remove a QoS 1 outbound publish after PUBACK is received.
§

fn store_outgoing_qos2( &mut self, packet_id: PacketId, phase: Qos2Phase, topic: &Topic, payload: &[u8], retain: bool, properties: &PublishProperties, )

Store a QoS 2 outbound publish. Read more
§

fn advance_outgoing_qos2(&mut self, packet_id: PacketId)

Advance a QoS 2 outbound publish to the PUBREL-sent phase. Read more
§

fn remove_outgoing_qos2(&mut self, packet_id: PacketId)

Remove a QoS 2 outbound publish after PUBCOMP is received (or PUBREC with rc ≥ 0x80).
§

fn store_incoming_qos2(&mut self, packet_id: PacketId)

Store a QoS 2 inbound packet identifier (PUBREC sent, awaiting PUBREL from the server).
§

fn remove_incoming_qos2(&mut self, packet_id: PacketId)

Remove a QoS 2 inbound packet identifier after PUBREL is received and PUBCOMP has been sent.
§

fn has_outgoing_qos1(&self, packet_id: PacketId) -> bool

Check whether a QoS 1 outbound publish is stored for this packet ID.
§

fn has_outgoing_qos2(&self, packet_id: PacketId) -> bool

Check whether a QoS 2 outbound publish is stored for this packet ID.
§

fn has_incoming_qos2(&self, packet_id: PacketId) -> bool

Check whether a QoS 2 inbound packet identifier is stored (i.e., PUBREC was already sent for this packet ID).
§

fn try_for_each_outgoing_qos1<B>( &self, f: Qos1Callback<'_, B>, ) -> ControlFlow<B>

Iterate over all stored outgoing QoS 1 messages for retransmission on reconnect. Read more
§

fn try_for_each_outgoing_qos2<B>( &self, f: &mut dyn FnMut(OutgoingQos2<'_>) -> ControlFlow<B>, ) -> ControlFlow<B>

Iterate over all stored outgoing QoS 2 messages for retransmission on reconnect. Read more
§

fn try_for_each_incoming_qos2<B>( &self, f: &mut dyn FnMut(PacketId) -> ControlFlow<B>, ) -> ControlFlow<B>

Iterate over all stored incoming QoS 2 packet identifiers for re-acknowledging on reconnect. Read more
§

fn clear(&mut self)

Clear all session state. Called when connecting with Clean Start = 1.

Auto Trait Implementations§

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.