Skip to main content

Compiler

Struct Compiler 

Source
pub struct Compiler { /* private fields */ }
Expand description

Owns schema-compilation cache state. Construct one per process (or per isolated tenant); nothing here is required to be a singleton.

Implementations§

Source§

impl Compiler

Source

pub fn new(options: CompilerOptions) -> Self

A compiler with its own cache, budgeted per options.

Source

pub fn without_cache() -> Self

A compiler that caches nothing: every compile and bind rebuilds its artifacts. Useful for deterministic tests or callers that cache SchemaProgram themselves.

Source

pub fn compile_json_schema( &self, schema: &str, ) -> Result<SchemaProgram, CompileError>

Compiles JSON Schema text with default options. Vocabulary-independent: reuse the returned SchemaProgram across every vocabulary that needs this schema.

Source

pub fn compile_json_schema_with_options( &self, schema: &str, options: CompileOptions, ) -> Result<SchemaProgram, CompileError>

Compiles JSON Schema text with explicit lowering options.

Source

pub fn compile_json_schema_with_resources( &self, schema: &str, retrieval_uri: Option<&str>, resources: &[(String, String)], options: CompileOptions, limits: SchemaResourceLimits, ) -> Result<SchemaProgram, CompileError>

Compiles against caller-supplied resources; never fetches a $ref target itself.

Source

pub fn compile_ir_wire( &self, wire: &[u8], ) -> Result<SchemaProgram, CompileError>

Decodes and compiles a frozen MFIR wire payload (see crate::SchemaIR::to_wire).

Source

pub fn cache_stats(&self) -> ExecutableCacheStats

Current retention plus cumulative traffic for the executable cache.

Source

pub fn trie_cache_stats(&self) -> TrieCacheStats

Current retention plus cumulative traffic for the shared vocabulary trie cache.

Source

pub fn clear_caches(&self)

Drops every cached executable and retained vocabulary trie; an existing BoundSchema keeps its own Arc-retained trie safely.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.