Enum FilterState
pub enum FilterState {
Subscribing {
packet_id: PacketId,
request: SubscriptionSpec,
restore: Option<SubscriptionSpec>,
},
Subscribed(SubscriptionSpec),
Resubscribing(SubscriptionSpec),
Unsubscribing {
packet_id: PacketId,
restore: Option<SubscriptionSpec>,
},
}Expand description
Lifecycle state of a topic filter.
Each filter the application has touched is one entry with one state. A
filter cannot be a confirmed subscription and a separate in-flight
SUBSCRIBE at once. That overlap allowed a filter to be sent twice on a
session reset. Subscribing/Unsubscribing store the packet identifier of
the request that owns them.
Variants§
Subscribing
A SUBSCRIBE for this filter is in flight (or queued for the next connection). It awaits its SUBACK.
Fields
request: SubscriptionSpecThe requested subscription.
restore: Option<SubscriptionSpec>The confirmed subscription this request replaces, if any. A clear reverts to it.
Subscribed(SubscriptionSpec)
The broker granted the subscription.
Resubscribing(SubscriptionSpec)
The subscription was confirmed, but the server lost its session. A SUBSCRIBE is sent again once a packet identifier is free.
Unsubscribing
An UNSUBSCRIBE for this filter is in flight (or queued). It awaits its UNSUBACK.
Fields
restore: Option<SubscriptionSpec>The subscription to revert to if the UNSUBACK rejects the removal
(rc >= 0x80), or if a clear drops the request. None drops the
entry on any outcome.
Implementations§
§impl FilterState
impl FilterState
pub const TAG_SUBSCRIBING: u8 = 0
pub const TAG_SUBSCRIBING: u8 = 0
Persistence tag for the Subscribing variant.
pub const TAG_SUBSCRIBED: u8 = 1
pub const TAG_SUBSCRIBED: u8 = 1
Persistence tag for the Subscribed variant.
pub const TAG_UNSUBSCRIBING: u8 = 2
pub const TAG_UNSUBSCRIBING: u8 = 2
Persistence tag for the Unsubscribing variant.
pub const TAG_RESUBSCRIBING: u8 = 3
pub const TAG_RESUBSCRIBING: u8 = 3
Persistence tag for the Resubscribing variant.
pub const fn tag(self) -> u8
pub const fn tag(self) -> u8
The persistence tag byte identifying this state’s variant.
Persistence backends encode the variant with this byte and decode it
back through the TAG_* constants, so the journal and any external
store share one tag numbering instead of each redeclaring it.
pub const fn confirmed(self) -> Option<SubscriptionSpec>
pub const fn confirmed(self) -> Option<SubscriptionSpec>
The confirmed subscription a new SUBSCRIBE of a filter in this state replaces.
pub const fn unsubscribe_restore(self) -> Option<SubscriptionSpec>
pub const fn unsubscribe_restore(self) -> Option<SubscriptionSpec>
The subscription to restore if an UNSUBSCRIBE of a filter in this state is rejected. Only a confirmed subscription that the server still has can be restored.
pub const fn after_session_loss(self) -> Option<Self>
pub const fn after_session_loss(self) -> Option<Self>
The state after the server lost the session, if it changes. A confirmed subscription has to be sent again, and a pending UNSUBSCRIBE has no subscription left to restore.
pub const fn after_clear(self) -> Option<Self>
pub const fn after_clear(self) -> Option<Self>
The state after a clear, or None if the entry is dropped. A pending
request reverts to the subscription it replaces.
pub const fn resubscribe(self, packet_id: PacketId) -> Option<Self>
pub const fn resubscribe(self, packet_id: PacketId) -> Option<Self>
The SUBSCRIBE that restores a subscription the server lost, under
packet_id. None unless the state is
Resubscribing.
Trait Implementations§
§impl Clone for FilterState
impl Clone for FilterState
§fn clone(&self) -> FilterState
fn clone(&self) -> FilterState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FilterState
§impl Debug for FilterState
impl Debug for FilterState
impl Eq for FilterState
§impl PartialEq for FilterState
impl PartialEq for FilterState
impl StructuralPartialEq for FilterState
Auto Trait Implementations§
impl Freeze for FilterState
impl RefUnwindSafe for FilterState
impl Send for FilterState
impl Sync for FilterState
impl Unpin for FilterState
impl UnsafeUnpin for FilterState
impl UnwindSafe for FilterState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more