Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 692 Bytes

File metadata and controls

26 lines (19 loc) · 692 Bytes

API overview

PacketParts

A PacketParts struct decomposes a packet into its components:

let parts = PacketParts::new(id, correlation_id, payload);
  • id: u32 — envelope identifier used for routing (packet in trait abstraction contexts)
  • correlation_id: Option<u64>None marks an unsolicited event or server‑initiated push
  • payload: Vec<u8> — raw message bytes

Custom packet types can convert to and from PacketParts to avoid manual mapping:

let parts = PacketParts::new(id, None, data);
let env = Envelope::from(parts);

None propagation ensures packets that originate on the server carry no accidental correlation identifier.