Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command line

The predsync facade crate provides two commands through the predsync binary: schema_check validates receiver schema sets, and schema_build generates typed Rust wrappers from them. Both accept hyphenated aliases (schema-check, schema-build). Install the tool with cargo install predsync --locked.

Use the pixi tasks, or call the binary directly with Cargo:

pixi run schema-check --set examples/schema_sets/alpha --set examples/schema_sets/beta
pixi run schema-build --set examples/generated_example/schema/telemetry.yaml --out src/telemetry.rs
cargo run -p predsync --bin predsync -- \
  schema_check --set examples/schema_sets/alpha --set examples/schema_sets/beta

cargo run -p predsync --bin predsync -- \
  schema_build --set examples/generated_example/schema/telemetry.yaml --out src/telemetry.rs

A set path may be a YAML file or a directory of .yaml files. --set may be repeated; sets are checked independently and then compared for inconsistent IDs. Neither command needs network access.

schema_check

schema_check parses and validates every schema, then prints a deterministic table with one row per message per set, sorted by qualified name and set label. Set labels are path file names, not absolute paths. It has no side effects.

predsync schema_check --set <dir-or-file> [--set <dir-or-file>...]

schema_build

schema_build runs the same checks, then writes one generated Rust module to --out. Parent directories are created if needed. Generation is deterministic: the same sets always produce the same bytes, so the output is safe to commit or include! directly.

predsync schema_build --set <dir-or-file> [--set <dir-or-file>...] --out <file>

The generated module contains namespace and message modules, ID and FIELD_* constants, enum types, message structs with to_values()/from_values(), and the SCHEMA_REF, STORAGE_LAYOUT and generated PredictorSet items described in Generated wrappers.

schema_build generates Rust only. Use generate_python or generate_c from the predsync_compiler library for other languages. Schemas that use custom predictors still need a build.rs so the predictor implementations can be registered with Builder::custom_predictor.

Exit codes

Codeschema_checkschema_build
0All checks passed.Checks passed and the module was written.
1A set was invalid or an ID collided.A set was invalid, code generation failed, or the output could not be written.
2The command line was malformed.The command line was malformed.

predsync help prints the usage lines.