Skip to main content

OutboundAliasTable

Trait OutboundAliasTable 

pub trait OutboundAliasTable {
    type Error;

    // Required methods
    fn clear(&mut self);
    fn decide(&self, topic: &Topic) -> AliasDecision;
    fn establish(
        &mut self,
        topic: &Topic,
        alias: NonZeroU16,
    ) -> Result<(), Self::Error>;
    fn release(&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. The client clears the table before it first uses it on a new connection.

Required Associated Types§

type Error

Error returned when the table cannot store a mapping.

Required Methods§

fn clear(&mut self)

Removes every mapping.

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

Decides the alias for topic without changing the table.

The alias must not exceed the server’s Topic Alias Maximum. The client sends the topic without an alias otherwise.

fn establish( &mut self, topic: &Topic, alias: NonZeroU16, ) -> Result<(), Self::Error>

Records a New alias before its establishing PUBLISH is written.

§Errors

Returns Error if the table has no room for topic. The PUBLISH is then not written.

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

Removes an alias whose establishing PUBLISH could not be written.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl OutboundAliasTable for OutboundAliases

Available on crate feature tokio only.