Skip to main content

Node

Enum Node 

Source
#[non_exhaustive]
pub enum Node {
Show 21 variants Null, Boolean, Never, StringConst { value: StrRef, }, StringPattern { regex: StrRef, min_len: Option<u32>, max_len: Option<u32>, charset: Charset, }, Integer { minimum: Option<i64>, maximum: Option<i64>, multiple_of: Option<u64>, }, Number { integer_only: bool, minimum: Option<(i128, u32, bool)>, maximum: Option<(i128, u32, bool)>, multiple_of: Option<(u64, u32)>, }, LexicalNumber { regex: StrRef, }, Enum { values: LitSlice, }, Array { items: ItemsPolicy, min_items: u32, max_items: Option<u32>, unique_items: bool, contains: Option<ContainsConstraint>, items_annotates: bool, }, Tuple { prefix: RefSlice, tail: Option<NodeId>, min_items: u32, max_items: Option<u32>, unique_items: bool, tail_annotates: bool, contains: Option<ContainsConstraint>, }, Object { fields: PropSlice, required: BitSlice, closure: ObjectClosure, dependent: PropSlice, dependent_required: DependentRequiredSlice, }, OpenObject { known: PropSlice, known_required: BitSlice, patterns: PropSlice, additional: AdditionalPolicy, property_names: Option<NodeId>, min_properties: Option<u32>, max_properties: Option<u32>, dependent: PropSlice, dependent_required: DependentRequiredSlice, }, Union { branches: RefSlice, }, Intersection { branches: RefSlice, }, ExactlyOne { branches: RefSlice, }, Not { inner: NodeId, }, Ref { def: u32, }, DynamicRef { initial_target: NodeId, anchor: AnchorId, }, Unevaluated { kind: UnevaluatedKind, scope: NodeId, unevaluated: NodeId, }, Unsupported { keyword: StrRef, reason: UnsupportedReason, },
}
Expand description

One arena node. Children are NodeId indices; scalars live in side blobs. #[non_exhaustive].

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Null

Matches literal null.

§

Boolean

Matches true or false.

§

Never

Matches no value at all (the bare false schema). A regular language like any other leaf: an impossible byte class, dead from the very first byte, never needs the structured backend.

§

StringConst

A fixed string literal.

Fields

§value: StrRef

The literal value (a JSON string body, before JSON quoting).

§

StringPattern

A regular pattern over a chosen byte alphabet, optionally length-bounded.

Fields

§regex: StrRef

The byte-level regex body.

§min_len: Option<u32>

Inclusive minimum length in code points, when bounded.

§max_len: Option<u32>

Inclusive maximum length in code points, when bounded.

§charset: Charset

The alphabet the body is drawn from.

§

Integer

A signed 64-bit integer with optional inclusive bounds and an optional exact divisor.

Fields

§minimum: Option<i64>

Inclusive lower bound.

§maximum: Option<i64>

Inclusive upper bound.

§multiple_of: Option<u64>

multipleOf: the value must be exactly divisible by this positive integer.

§

Number

Any JSON number with sign, integer part, and optional fraction. Bounded forms omit exponents; genuinely fractional bounds remain unsupported.

Fields

§integer_only: bool

Whether the mathematical value, rather than its spelling, must be integral.

§minimum: Option<(i128, u32, bool)>

Lower bound as (scaled_value, scale, exclusive): the value is scaled_value * 10^-scale (scale = 0 is an integer bound), exclusive = true for a strict bound.

§maximum: Option<(i128, u32, bool)>

Upper bound, same (scaled_value, scale, exclusive) encoding.

§multiple_of: Option<(u64, u32)>

multipleOf as coef * 10^-exp (exact decimal), when present.

§

LexicalNumber

A JSON number constrained by lexical digit counts.

Fields

§regex: StrRef

Anchored byte regex for the complete number token.

§

Enum

A closed set of scalar literals (non-empty, canonically sorted, duplicate-free).

Fields

§values: LitSlice

The member values.

§

Array

A homogeneous array with a cardinality bound.

Fields

§items: ItemsPolicy

What every element must satisfy.

§min_items: u32

Inclusive minimum item count.

§max_items: Option<u32>

Inclusive maximum item count, when bounded.

§unique_items: bool

uniqueItems: no two items may be the same JSON value. Not a regular-language property (needs unbounded memory of prior items), so this always routes through crate::structured.

§contains: Option<ContainsConstraint>

contains/minContains/maxContains, when present.

§items_annotates: bool

Whether items was textually present (true or a schema), for unevaluatedItems: an absent items validates identically but annotates no index (proven by the official suite).

§

Tuple

A positional (tuple) array: prefix positions validate in order, tail validates the rest (absent = closed); length runs from min_items to max_items (and the prefix, if closed).

Fields

§prefix: RefSlice

The positional element schemas, in array order.

§tail: Option<NodeId>

The schema for items past the prefix, or None for a closed tuple.

§min_items: u32

Inclusive minimum item count.

§max_items: Option<u32>

Inclusive maximum item count, when bounded.

§unique_items: bool

uniqueItems, same semantics and structured-backend requirement as Node::Array’s.

§tail_annotates: bool

Whether items was textually present past prefixItems, mirroring items_annotates.

§contains: Option<ContainsConstraint>

contains/minContains/maxContains, when present.

§

Object

An object with source-ordered fields, a positional required bitset, and a closure policy.

Fields

§fields: PropSlice

The (name, child) fields, in source order.

§required: BitSlice

The required-field bitset (indexed by field position).

§closure: ObjectClosure

How additional properties are treated.

§dependent: PropSlice

dependentSchemas: when key is present, the whole instance must also satisfy schema. Instance-dependent, so a non-empty run always needs crate::structured.

§dependent_required: DependentRequiredSlice

dependentRequired flattened as decoded trigger/required name pairs.

§

OpenObject

An order-independent object: known properties, patternProperties, and an additional-key policy, none of which can be represented as one finite byte-level regex.

Fields

§known: PropSlice

The exact (name, child) properties, matched independent of textual order.

§known_required: BitSlice

The required-field bitset, aligned to known by position.

§patterns: PropSlice

The (pattern, child) patternProperties entries; a key may match more than one.

§additional: AdditionalPolicy

How a key matching neither known nor patterns is treated.

§property_names: Option<NodeId>

An optional schema every key (known, pattern-matched, or additional) must satisfy.

§min_properties: Option<u32>

Inclusive minimum property count.

§max_properties: Option<u32>

Inclusive maximum property count, when bounded.

§dependent: PropSlice

dependentSchemas, same semantics as Node::Object’s.

§dependent_required: DependentRequiredSlice

dependentRequired flattened as decoded trigger/required name pairs.

§

Union

A type union: matches any of its branches, in declaration order (deduplicated by type).

Fields

§branches: RefSlice

The branch nodes.

§

Intersection

An allOf: matches iff every branch matches (language intersection).

Fields

§branches: RefSlice

The branch nodes.

§

ExactlyOne

A oneOf: matches iff exactly one branch matches.

Fields

§branches: RefSlice

The branch nodes.

§

Not

Matches complete JSON values that inner does not match. Full JSON-value complement requires crate::structured.

Fields

§inner: NodeId

The negated schema.

§

Ref

A recursion cut point: a leaf whose body is def_targets[def], an edge free of the back-edge rule so a $ref cycle needs no cyclic child graph. Followed only by crate::structured.

Fields

§def: u32

Index into the SchemaIR::def_targets table naming the definition body.

§

DynamicRef

A $dynamicRef whose initially resolved fragment names a $dynamicAnchor.

Fields

§initial_target: NodeId

Statically resolved target used when dynamic scope does not rebind the name.

§anchor: AnchorId

Initial dynamic-anchor declaration, which supplies the plain-name identity.

§

Unevaluated

Requires unannotated properties or items in scope to match unevaluated. Annotation tracking requires crate::structured.

Fields

§kind: UnevaluatedKind

Which instance type this obligation targets.

§scope: NodeId

The schema minus the unevaluated keyword (local assertions and in-place applicators).

§unevaluated: NodeId

The schema each unevaluated member must satisfy (Never for false).

§

Unsupported

An occurrence the dialect does not support. Carries no pointer; provenance is the sidecar.

Fields

§keyword: StrRef

The offending keyword.

§reason: UnsupportedReason

The machine-stable reason.

Trait Implementations§

Source§

impl<'__de, __Context> BorrowDecode<'__de, __Context> for Node

Source§

fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl Clone for Node

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 Node

Source§

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

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

impl<__Context> Decode<__Context> for Node

Source§

fn decode<__D: Decoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl Encode for Node

Source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl Eq for Node

Source§

impl Hash for Node

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Node

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Node

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

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.