Skip to main content

encode_data_command

Function encode_data_command 

Source
pub fn encode_data_command(
    command: &DataCommand,
) -> Result<EncodedPayload, EncodeError>
Expand description

Encodes a [DataCommand] envelope by dispatching on its command category.

send_data_command hands the bus tap a [DataCommand] wrapper, so the tap dispatches by the wrapper’s std::any::TypeId and the inner command category never reaches a bare-type encoder. The dispatcher unwraps the category, encodes the serializable inner enum (RequestCommand, SubscribeCommand, or UnsubscribeCommand), and stamps that category’s canonical payload_type tag.

Request IDs, command IDs, and correlation IDs do not have a matching IndexKind today, so data commands emit no sidecar indices. Correlation is recovered from the captured payload and, once header propagation lands, propagated headers.

§Errors

Returns an error if MessagePack rejects the inner payload, or when a future non-exhaustive [DataCommand] variant has no encoder yet.