Skip to main content

Crate wire

Crate wire 

Source
Expand description

Wire framing and packet layout for the sdec codec.

This crate handles the binary wire format: packet headers, section framing, and limit enforcement. It does not know about game state types—only the structure of packets.

§Design Principles

  • Stable wire format - The format is versioned and changes are documented.
  • Bounded decoding - All length fields are validated against limits before iteration.
  • No domain knowledge - This crate handles framing, not game logic.

See WIRE_FORMAT.md for the complete specification.

Structs§

Limits
Wire-level limits for packet decoding.
PacketFlags
Packet flags.
PacketHeader
Packet header (version 0).
WirePacket
A decoded wire packet.
WireSection
A section within a wire packet.

Enums§

DecodeError
High-level decode errors for wire framing.
EncodeError
Errors that can occur during encoding.
LimitKind
Specific wire limits that can be exceeded.
SectionFramingError
Errors that can occur while framing sections.
SectionTag
Section tags for version 0.

Constants§

HEADER_SIZE
Header size in bytes (28 total).
MAGIC
Magic number identifying sdec packets.
VERSION
Current wire format version.

Functions§

decode_packet
Decodes a wire packet into header + section slices.
encode_header
Encodes a packet header into the provided output buffer.
encode_section
Encodes a single section into the provided output buffer.

Type Aliases§

WireResult
Result type for wire format operations.