Skip to main content

Crate schema

Crate schema 

Source
Expand description

Replication schema and field codec definitions for the sdec codec.

This crate defines how game state is represented for replication:

  • Schema model for entity types, components, and fields
  • Field codecs (bool, integers, fixed-point, varints)
  • Quantization and threshold configuration
  • Deterministic schema hashing

§Design Principles

  • Runtime-first - the initial release uses runtime schema building; derive macros come later.
  • Explicit schemas - No reflection on arbitrary Rust types.
  • Deterministic hashing - Schema hash is stable given the same definition.

Structs§

ComponentDef
A component definition within a schema.
ComponentId
A component ID within a schema (non-zero).
FieldDef
Field definition within a component.
FieldId
A field ID within a component (non-zero).
FixedPoint
Fixed-point quantization parameters (all integer-based).
Schema
A schema consisting of ordered components.
SchemaBuilder
Builder for Schema.

Enums§

ChangePolicy
Change detection policy for a field.
FieldCodec
The encoding for a field (representation only).
SchemaError
Errors that can occur when building or validating a schema.

Functions§

schema_hash
Computes a deterministic hash for schema validation.

Type Aliases§

SchemaResult
Result type for schema operations.