TopicAliasTable

Trait TopicAliasTable 

pub trait TopicAliasTable {
    // Required methods
    fn decide(&self, topic: &Topic) -> AliasDecision;
    fn confirm(&mut self, topic: &Topic, alias: NonZeroU16);
}
Expand description

Per-connection outbound topic-alias assignment.

Held outside the Client because the alias map is transient connection scratch state and, on a no-alloc target, its storage (keyed by variable-length topics) must be supplied by the embedder. An alloc-backed implementation lives in the I/O layer.

Required Methods§

fn decide(&self, topic: &Topic) -> AliasDecision

Decides the alias for topic without mutating state. A New decision must only be recorded once the packet reaches the wire (see confirm), so a publish dropped before sending leaves no phantom mapping.

fn confirm(&mut self, topic: &Topic, alias: NonZeroU16)

Records a New alias after its establishing PUBLISH has been written.

Implementors§