Skip to main content

Crate predsync_core

Crate predsync_core 

Source
Expand description

Deterministic encoder and decoder for low-bandwidth predictor-state sync.

The crate is no_std. With the default alloc feature, Encoder and Decoder accept owned Values and allocate output buffers for you. Disable alloc and use with_storage/plan_into/decode_into to supply every scratch buffer yourself. The wire format is identical on both paths.

use predsync_core::Slot;

let slot = Slot::from_f64(1.25);
assert_eq!(slot.as_f64(), 1.25);

See the predsync-compiler crate for YAML parsing and typed wrapper generation, and the book in docs/book for the protocol contract.

Re-exports§

pub use decoder::Decoded;
pub use decoder::Decoder;
pub use decoder::DecodeError;
pub use decoder::DecoderConfig;
pub use encoder::Encoder;
pub use encoder::Plan;
pub use encoder::ConfigError;
pub use encoder::EncodeError;
pub use encoder::EncodeInfo;
pub use encoder::EncoderConfig;
pub use encoder::PredictorBuilder;
pub use encoder::Presence;
pub use registry::PredictorRegistry;
pub use slot::ScalarType;
pub use slot::Slot;
pub use value::Value;
pub use value::BoundedValue;
pub use value::ValueRef;
pub use self as schema;

Modules§

bits
LSB-first bit packing shared by the encoder, decoder and wire primitives.
crc
CRC-16/IBM-SDLC, the frame checksum used by predsync.
decoder
Decoder engine: parse validates into staging buffers; apply mutates state.
encoder
Two-phase encoder: plan is pure and commit writes one frame.
hash
FNV-1a hashes, message IDs and predictor state hashes.
managed
Borrowed-or-owned contiguous storage for no-alloc/alloc engines.
opaque
Canonical opaque value representation for hold-last state and hashing.
predictor
Predictor implementations for numeric and opaque fields.
quant
Quantisation, casting and the final value emitted to the receiver.
registry
Explicit runtime registry for custom predictor models (alloc-only).
slot
Slot is the uniform scalar representation at the core API boundary.
storage
Storage layout calculation for the shared engine.
tol
Tolerance bounds for numeric predictor fields.
value
Value representations for alloc and bounded/no-alloc paths.

Structs§

FieldOut
One decoded field and its trust state.
FieldSchema
One field of a message, in wire order.

Enums§

PredictorKind
Predictor kinds supported by the schema.
Validity
The trust state of one decoded field.

Functions§

core_smoke_value
Returns a fixed value used by the M0 scaffolding smoke test.