Skip to main content

SchemaIR

Struct SchemaIR 

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

The arena IR. Built once and frozen; all fields private.

Implementations§

Source§

impl SchemaIR

Source

pub fn ir_version(&self) -> u16

The IR schema version.

Source

pub fn root(&self) -> NodeId

The root node id.

Source

pub fn node(&self, id: NodeId) -> Option<&Node>

The node at id, or None if the id is out of range.

Source

pub fn nodes(&self) -> impl ExactSizeIterator<Item = &Node>

All nodes in arena order.

Source

pub fn node_count(&self) -> usize

The number of nodes in the arena.

Source

pub fn retrieval_uri(&self) -> Option<&str>

Optional root retrieval URI retained in the compact string blob.

Source

pub fn resources(&self) -> &[ResourceRecord]

Frozen schema resources in canonical order.

Source

pub fn anchors(&self) -> &[AnchorRecord]

Frozen static and dynamic anchor records.

Source

pub fn node_resource(&self, node: NodeId) -> Option<ResourceId>

Resource that owns node, or None for an invalid node ID.

Source

pub fn diagnostics(&self) -> impl ExactSizeIterator<Item = &Diagnostic>

Every diagnostic, one per rejected occurrence.

Source

pub fn requires_structured_backend(&self) -> bool

Whether any arena node needs crate::structured instead of compile::compile_ir: an OpenObject, an oversized object shuffle, uniqueItems/contains, dependentSchemas, or an unrolled-codepoint-count string too long to build as one DFA cheaply.

Source

pub fn route_table(&self) -> &RouteTable

The shared immutable per-node route table, computed once for this frozen IR.

Source

pub fn options(&self) -> &CompileOptions

The compile options this IR was built with.

Source

pub fn str_at(&self, r: StrRef) -> Option<&str>

Resolves a string reference to its UTF-8 slice, or None if the run is out of range.

Source

pub fn lits_at(&self, r: LitSlice) -> Option<&[ScalarLit]>

Resolves a literal run, or None if out of range.

Source

pub fn props_at(&self, r: PropSlice) -> Option<&[(StrRef, NodeId)]>

Resolves a property run, or None if out of range.

Source

pub fn dependent_required_at( &self, r: DependentRequiredSlice, ) -> Option<&[DependentRequiredPair]>

Resolves a dependentRequired pair run, or None if out of range.

Source

pub fn def_target(&self, def: u32) -> Option<NodeId>

The definition body a Node::Ref { def } names, or None if the slot is out of range.

Source

pub fn refs_at(&self, r: RefSlice) -> Option<&[NodeId]>

Resolves a branch run, or None if out of range.

Source

pub fn is_required(&self, r: BitSlice, idx: u32) -> bool

Whether field idx of an object with required set r is required.

Source

pub fn canonical_hash(&self) -> [u8; 32]

The memoized blake3 Merkle content address over node semantics (tags, scalars, child digests, closure, required bits) only; pointers, layout, diagnostics, and CompileOptions are excluded.

Source

pub fn same_content_address(&self, other: &Self) -> bool

Whether two IRs share the same content address. This is cryptographic identity, not a structural proof: equal addresses mean the schemas are the same up to a BLAKE3 collision, which is the same guarantee any content-addressed store relies on.

Source

pub fn to_wire(&self) -> Vec<u8> ⓘ

Serializes the IR into the versioned MFIR envelope.

Source

pub fn from_wire(bytes: &[u8]) -> Result<Self, CompileError>

Deserializes and validates an MFIR envelope into a frozen IR.

Trait Implementations§

Source§

impl Clone for SchemaIR

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SchemaIR

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SchemaIR

Source§

impl PartialEq for SchemaIR

Source§

fn eq(&self, other: &Self) -> bool

Exact frozen representation equality: every field (arena order, blob offsets, options, and diagnostics) except the memoized hash. Two IRs with the same schema but a different arena layout or different rejected sites compare unequal; for language identity use SchemaIR::same_content_address or compare SchemaIR::canonical_hash.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.