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
impl InMemorySession
pub const fn new() -> Self
pub const fn new() -> Self
Create a new, empty in-memory session.
Trait Implementations§
§impl Default for InMemorySession
impl Default for InMemorySession
§impl SessionState for InMemorySession
impl SessionState for InMemorySession
§fn store_outgoing_qos1(
&mut self,
packet_id: PacketId,
topic: &Topic,
payload: &[u8],
retain: bool,
properties: &PublishProperties,
)
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)
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,
)
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)
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)
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)
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)
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
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
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
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>
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>
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>
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 moreAuto Trait Implementations§
impl Freeze for InMemorySession
impl RefUnwindSafe for InMemorySession
impl Send for InMemorySession
impl Sync for InMemorySession
impl Unpin for InMemorySession
impl UnwindSafe for InMemorySession
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