Skip to main content

Crate codec

Crate codec 

Source
Expand description

Snapshot and delta encoding/decoding for the sdec codec.

This is the main codec crate that ties together bitstream, wire, and schema to provide full snapshot and delta encoding/decoding capabilities.

§Features

  • Full snapshot encoding/decoding
  • Delta encoding relative to a baseline
  • Baseline history management
  • Entity create/update/destroy operations
  • Per-component and per-field change masks

§Design Principles

  • Correctness first - All invariants are documented and tested.
  • No steady-state allocations - Uses caller-provided buffers.
  • Deterministic - Same inputs produce same outputs.

Structs§

BaselineStore
A fixed-capacity ring buffer of baselines keyed by tick.
CodecLimits
Codec-specific limits enforced during snapshot decoding.
CodecScratch
Scratch buffers for delta encoding.
ComponentSnapshot
A component snapshot.
DeltaDecoded
DeltaUpdateComponent
DeltaUpdateEntity
EntityId
A stable entity identifier.
EntitySnapshot
An entity snapshot.
SessionEncoder
Encoder context for delta packets that use caller-provided change lists.
SessionState
Session state for compact headers.
Snapshot
A decoded snapshot.
SnapshotTick
A simulation tick number.
WireLimits
Wire-level limits for packet decoding.

Enums§

BaselineError
Errors that can occur when inserting into the baseline store.
CodecError
Errors that can occur during snapshot/delta encoding/decoding.
CompactHeaderMode
Compact header mode negotiated via session init.
FieldValue
A field value in decoded form.
LimitKind
Specific limit that was exceeded.
MaskKind
Mask validation error kinds.
MaskReason
Details for invalid mask errors.
ValueReason
Details for invalid value errors.

Functions§

apply_delta_snapshot
Applies a delta snapshot to a baseline snapshot.
apply_delta_snapshot_from_packet
Applies a delta snapshot from a parsed wire packet.
decode_delta_packet
Decodes a delta packet without applying it to a baseline.
decode_full_snapshot
Decodes a full snapshot from raw packet bytes.
decode_full_snapshot_from_packet
Decodes a full snapshot from a parsed wire packet.
decode_session_init_packet
Decodes a session init packet into session state.
decode_session_packet
Decodes a compact packet using session state.
encode_delta_from_changes
Encodes a delta snapshot from precomputed change lists.
encode_delta_snapshot
Encodes a delta snapshot into the provided output buffer.
encode_delta_snapshot_for_client
Encodes a delta snapshot for a client-specific view.
encode_delta_snapshot_for_client_session
Encodes a client delta snapshot using a compact session header.
encode_delta_snapshot_for_client_session_with_scratch
Encodes a client delta snapshot using a compact session header.
encode_delta_snapshot_for_client_with_scratch
Encodes a delta snapshot for a client-specific view using reusable scratch buffers.
encode_delta_snapshot_from_updates
Encodes a delta snapshot using precomputed change lists.
encode_delta_snapshot_with_scratch
Encodes a delta snapshot using reusable scratch buffers.
encode_full_snapshot
Encodes a full snapshot into the provided output buffer.
encode_session_init_packet
Encodes a session init packet.
select_baseline_tick
Selects the latest baseline tick at or before the ack tick.

Type Aliases§

CodecResult
Result type for codec operations.