Expand description
The stable, high-level facade: compile a schema once, prepare a vocabulary once, bind them, drive one generation sequence. Callers never inspect which backend a schema needs.
let compiler = Compiler::new(CompilerOptions::default());
let program = compiler.compile_json_schema(r#"{"type":"boolean"}"#)?;
let vocabulary = CompiledVocabulary::try_from(vocabulary)?;
let bound = program.bind(&vocabulary)?;
let mut session = bound.start_session()?;
session.write_mask(mask)?;Structs§
- Bound
Schema - A schema bound to one vocabulary. Immutable; start as many independent
Sessions from it as there are concurrent generation sequences. Cheap to clone. - Compiled
Vocabulary - A prepared, reusable vocabulary; build once and reuse across binds. Cheap to clone.
- Compiler
- Owns schema-compilation cache state. Construct one per process (or per isolated tenant); nothing here is required to be a singleton.
- Compiler
Options - Cache budgets a
Compilerowns, in bytes rather than entry counts. - Schema
Program - A compiled schema, immutable and vocabulary-independent. Cheap to clone (an
Archandle); safe to share across threads and reuse across as many vocabularies as needed. - Session
- One generation sequence’s mutable state. Never shared between concurrent sequences. Opaque: callers never inspect which backend it wraps.
- Trie
Cache Stats - Current retention plus cumulative traffic for a
Compiler’s trie cache.
Enums§
- Bind
Policy - How
SchemaProgram::bindchooses a regular-schema bind mode;Naivestays low-level-only. - Session
Error - Errors from binding a schema or driving a
Session.