Skip to main content

Module

Struct Module 

Source
pub struct Module {
Show 19 fields pub arena: Vec<Node>, pub bindings: HashMap<String, NodeId>, pub graph: DiGraph<NodeId, ()>, pub node_to_graph: HashMap<NodeId, NodeIndex>, pub root: Option<NodeId>, pub schemas: HashMap<String, NodeId>, pub diagnostics: Vec<Diagnostic>, pub source_name: String, pub node_spans: HashMap<NodeId, Span>, pub node_files: HashMap<NodeId, String>, pub healing: Vec<Diagnostic>, pub trivia: Vec<TriviaComment>, pub source_style: Style, pub includes: Vec<IncludeStmt>, pub profiles: IndexMap<String, NodeId>, pub patches: Vec<NodeId>, pub schema: Option<NodeId>, pub annotations: HashMap<NodeId, Vec<Annotation>>, pub depends_on: HashMap<NodeId, DependsOn>,
}

Fields§

§arena: Vec<Node>§bindings: HashMap<String, NodeId>§graph: DiGraph<NodeId, ()>§node_to_graph: HashMap<NodeId, NodeIndex>§root: Option<NodeId>§schemas: HashMap<String, NodeId>§diagnostics: Vec<Diagnostic>§source_name: String§node_spans: HashMap<NodeId, Span>

Source spans for nodes, recorded by the parser so evaluation-time diagnostics can point at real positions.

§node_files: HashMap<NodeId, String>

Source file per node, parallel to node_spans (C-025 includes).

§healing: Vec<Diagnostic>

Healing diagnostics (H0xx): repairs the parser applied or declined, with confidence scores. Separate from diagnostics so callers can apply mode-dependent gating.

§trivia: Vec<TriviaComment>

Comments with their normative attachment (spec/dual-syntax.md §7-§8), recorded so the formatter can re-emit them losslessly.

§source_style: Style

The layout style the source predominantly used (for Preserve mode).

§includes: Vec<IncludeStmt>

Include statements in source order (spec §2.7). The formatter re-emits them; evaluation merges them per the defaults rule, so the composed tree does not need them.

§profiles: IndexMap<String, NodeId>

Named profiles in source order (spec §2.8, C-027). Never exported directly; the selected one merges into the root value at evaluation.

§patches: Vec<NodeId>

Structural patch directives in source order (spec §2.9, C-028). Applied to the evaluated value tree after profile merge.

§schema: Option<NodeId>

The document schema tree (spec §2.10, C-030): the root schema table and every nested one, extracted from value fields at parse. None when the document declares no schema. C-031 validates against it.

§annotations: HashMap<NodeId, Vec<Annotation>>

Parsed # @… annotations by annotated node (spec/annotations.md, C-033): intent documentation, constraint predicates, and immutability flags for validators, the language server, and AI tooling. Comments themselves stay in trivia for the formatter.

§depends_on: HashMap<NodeId, DependsOn>

Dependency declarations by scope table (spec/linter.md §2, C-042): depends_on keys holding string arrays are extracted from value fields at parse (never exported) and recorded here against their scope’s table node.

Implementations§

Source§

impl Module

Source

pub fn new(source_name: impl Into<String>) -> Self

Source

pub fn add_node(&mut self, node: Node) -> NodeId

Source

pub fn add_edge(&mut self, from: NodeId, to: NodeId)

Source

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

Source

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

Source

pub fn record_span(&mut self, id: NodeId, span: Span)

Record the source span of a node for evaluation-time diagnostics.

Source

pub fn record_file(&mut self, id: NodeId, file: String)

Record the source file of a node (includes, C-025).

Source

pub fn value_paths(&self) -> HashMap<NodeId, String>

Dotted paths for value nodes walked from the document root (server.port), plus binding names for let values. Unmapped nodes (schema internals, constraint expressions, orphans) are absent: callers skip what they cannot name rather than guessing. Shared by the linter and the language server (C-043 hover/definition).

Source

pub fn resolve_value_path(&self, path: &str) -> Option<NodeId>

Resolve a dotted path from the document root to a value-table node (C-042): each segment indexes a Node::Table’s fields. A single segment additionally resolves let bindings (table fields win ties). Returns None for missing keys, non-table hops, and a missing root. Shared by graph construction (depends_on edges) and the linter (dangling-path detection), so both agree on what resolves.

Trait Implementations§

Source§

impl Clone for Module

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 Module

Source§

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

Formats the value using the given formatter. 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> Same for T

Source§

type Output = T

Should always be Self
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.