Module transmit

Module transmit 

Expand description

The outbound transmit path: encoding pending session state onto the wire.

Client::poll_transmit is the single place outgoing SUBSCRIBE, UNSUBSCRIBE, PUBLISH, and PUBREL packets are produced. It owns topic-alias assignment (via a caller-supplied TopicAliasTable), Maximum Packet Size enforcement, and encoding into a PacketWriter, so an I/O driver only has to move the resulting bytes.

SUBSCRIBE/UNSUBSCRIBE payloads are encoded straight from the session’s pending-filter iterators in two passes (length, then bytes), so the drain stays allocation-free regardless of the session backend.

Enums§

AliasDecision
What to do with the topic alias for an outgoing PUBLISH (§3.3.2.3.4).
Encoded 🔒
Disposition of one encode_publish attempt.
TransmitEvent
An outcome of Client::poll_transmit the caller must act on, reported per packet identifier so the driver can resolve the user-facing future.

Traits§

TopicAliasTable
Per-connection outbound topic-alias assignment.

Functions§

encode_publish 🔒
Resolves the topic alias for a publish, enforces max_packet_size, and encodes it into out. The single place an outgoing PUBLISH is built, shared by the session drain and the QoS 0 path. A New alias is confirmed only once the packet is actually written, so a dropped publish leaves no phantom mapping.
encode_subscribe 🔒
Encodes one pending SUBSCRIBE group straight from the session’s iterator in two passes (length, then bytes), needing no intermediate buffer.
encode_unsubscribe 🔒
Encodes one pending UNSUBSCRIBE group; see encode_subscribe.
transmit_qos0
Encodes a QoS 0 (fire-and-forget) PUBLISH into out.
write_group 🔒
Frames a SUBSCRIBE/UNSUBSCRIBE group and writes it in one piece: fixed header (§3.8.1/§3.10.1 mandate flags 0b0010), packet id, properties section, then the caller’s payload.