pub struct SchemaIR { /* private fields */ }Expand description
The arena IR. Built once and frozen; all fields private.
Implementations§
Source§impl SchemaIR
impl SchemaIR
Sourcepub fn ir_version(&self) -> u16
pub fn ir_version(&self) -> u16
The IR schema version.
Sourcepub fn node(&self, id: NodeId) -> Option<&Node>
pub fn node(&self, id: NodeId) -> Option<&Node>
The node at id, or None if the id is out of range.
Sourcepub fn nodes(&self) -> impl ExactSizeIterator<Item = &Node>
pub fn nodes(&self) -> impl ExactSizeIterator<Item = &Node>
All nodes in arena order.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
The number of nodes in the arena.
Sourcepub fn retrieval_uri(&self) -> Option<&str>
pub fn retrieval_uri(&self) -> Option<&str>
Optional root retrieval URI retained in the compact string blob.
Sourcepub fn resources(&self) -> &[ResourceRecord]
pub fn resources(&self) -> &[ResourceRecord]
Frozen schema resources in canonical order.
Sourcepub fn anchors(&self) -> &[AnchorRecord]
pub fn anchors(&self) -> &[AnchorRecord]
Frozen static and dynamic anchor records.
Sourcepub fn node_resource(&self, node: NodeId) -> Option<ResourceId>
pub fn node_resource(&self, node: NodeId) -> Option<ResourceId>
Resource that owns node, or None for an invalid node ID.
Sourcepub fn diagnostics(&self) -> impl ExactSizeIterator<Item = &Diagnostic>
pub fn diagnostics(&self) -> impl ExactSizeIterator<Item = &Diagnostic>
Every diagnostic, one per rejected occurrence.
Sourcepub fn requires_structured_backend(&self) -> bool
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.
Sourcepub fn route_table(&self) -> &RouteTable
pub fn route_table(&self) -> &RouteTable
The shared immutable per-node route table, computed once for this frozen IR.
Sourcepub fn options(&self) -> &CompileOptions
pub fn options(&self) -> &CompileOptions
The compile options this IR was built with.
Sourcepub fn str_at(&self, r: StrRef) -> Option<&str>
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.
Sourcepub fn lits_at(&self, r: LitSlice) -> Option<&[ScalarLit]>
pub fn lits_at(&self, r: LitSlice) -> Option<&[ScalarLit]>
Resolves a literal run, or None if out of range.
Sourcepub fn props_at(&self, r: PropSlice) -> Option<&[(StrRef, NodeId)]>
pub fn props_at(&self, r: PropSlice) -> Option<&[(StrRef, NodeId)]>
Resolves a property run, or None if out of range.
Sourcepub fn dependent_required_at(
&self,
r: DependentRequiredSlice,
) -> Option<&[DependentRequiredPair]>
pub fn dependent_required_at( &self, r: DependentRequiredSlice, ) -> Option<&[DependentRequiredPair]>
Resolves a dependentRequired pair run, or None if out of range.
Sourcepub fn def_target(&self, def: u32) -> Option<NodeId>
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.
Sourcepub fn refs_at(&self, r: RefSlice) -> Option<&[NodeId]>
pub fn refs_at(&self, r: RefSlice) -> Option<&[NodeId]>
Resolves a branch run, or None if out of range.
Sourcepub fn is_required(&self, r: BitSlice, idx: u32) -> bool
pub fn is_required(&self, r: BitSlice, idx: u32) -> bool
Whether field idx of an object with required set r is required.
Sourcepub fn canonical_hash(&self) -> [u8; 32]
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.
Sourcepub fn same_content_address(&self, other: &Self) -> bool
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.
Sourcepub fn from_wire(bytes: &[u8]) -> Result<Self, CompileError>
pub fn from_wire(bytes: &[u8]) -> Result<Self, CompileError>
Deserializes and validates an MFIR envelope into a frozen IR.
Trait Implementations§
impl Eq for SchemaIR
Source§impl PartialEq for SchemaIR
impl PartialEq for SchemaIR
Source§fn eq(&self, other: &Self) -> bool
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.