FilterState

Enum FilterState 

pub enum FilterState {
    Subscribing {
        packet_id: PacketId,
        index: u16,
        options: SubscriptionOptions,
        subscription_id: Option<u32>,
    },
    Subscribed {
        options: SubscriptionOptions,
        subscription_id: Option<u32>,
    },
    Unsubscribing {
        packet_id: PacketId,
        index: u16,
        restore: Option<RestoredSubscription>,
    },
}
Expand description

Lifecycle state of a single topic filter.

Each filter the application has touched is one entry with one state, so a filter can never be both a confirmed subscription and a separate in-flight SUBSCRIBE at once (the overlap that allowed a filter to be sent twice on a session reset). The subscription options and identifier live on the states that have them (Subscribing/Subscribed), never on a bare entry, so an unsubscribe never has to invent them. Subscribing/Unsubscribing carry the packet identifier of the request that owns them and the filter’s index within that request, so a positional SUBACK/UNSUBACK reason code resolves the right filter.

Variants§

§

Subscribing

A SUBSCRIBE for this filter is in flight (or queued for the next connection); awaiting its SUBACK.

Fields

§packet_id: PacketId

Packet identifier of the owning SUBSCRIBE.

§index: u16

Position of this filter within the SUBSCRIBE payload.

§options: SubscriptionOptions

Subscription options requested for this filter.

§subscription_id: Option<u32>

Subscription identifier (§3.8.2.1.2) requested, if any.

§

Subscribed

The broker granted the subscription.

Fields

§options: SubscriptionOptions

Granted subscription options.

§subscription_id: Option<u32>

Subscription identifier (§3.8.2.1.2), if any.

§

Unsubscribing

An UNSUBSCRIBE for this filter is in flight (or queued); awaiting its UNSUBACK.

Fields

§packet_id: PacketId

Packet identifier of the owning UNSUBSCRIBE.

§index: u16

Position of this filter within the UNSUBSCRIBE payload.

§restore: Option<RestoredSubscription>

The subscription to revert to if the UNSUBACK rejects the removal (rc >= 0x80). Some when the filter was Subscribed beforehand; None to drop the entry on any outcome.

Implementations§

§

impl FilterState

pub const TAG_SUBSCRIBING: u8 = 0u8

Persistence tag for the Subscribing variant.

pub const TAG_SUBSCRIBED: u8 = 1u8

Persistence tag for the Subscribed variant.

pub const TAG_UNSUBSCRIBING: u8 = 2u8

Persistence tag for the Unsubscribing variant.

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(crate) const fn pending_slot(self) -> Option<(PacketId, u16)>

The (packet_id, index) slot this state occupies while its request is in flight, or None once Subscribed. The index orders the filter within its SUBSCRIBE/UNSUBSCRIBE so a positional ack resolves the right one.

pub(crate) const fn owner(self) -> Option<PacketId>

Packet id of the in-flight request that owns this state, if any.

Trait Implementations§

§

impl Clone for FilterState

§

fn clone(&self) -> FilterState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for FilterState

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl PartialEq for FilterState

§

fn eq(&self, other: &FilterState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Copy for FilterState

§

impl Eq for FilterState

§

impl StructuralPartialEq for FilterState

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.