Skip to main content

Module api

Module api 

Source
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§

BoundSchema
A schema bound to one vocabulary. Immutable; start as many independent Sessions from it as there are concurrent generation sequences. Cheap to clone.
CompiledVocabulary
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.
CompilerOptions
Cache budgets a Compiler owns, in bytes rather than entry counts.
SchemaProgram
A compiled schema, immutable and vocabulary-independent. Cheap to clone (an Arc handle); 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.
TrieCacheStats
Current retention plus cumulative traffic for a Compiler’s trie cache.

Enums§

BindPolicy
How SchemaProgram::bind chooses a regular-schema bind mode; Naive stays low-level-only.
SessionError
Errors from binding a schema or driving a Session.