pub struct Model {
pub mounts: Vec<Mount>,
pub nodes: Vec<NodeDecl>,
pub refs: Vec<RefDecl>,
pub rels: Vec<RelDecl>,
pub edges: Vec<EdgeDecl>,
pub defs_text: String,
pub aliases: Vec<AliasDecl>,
pub traits: Vec<TraitDecl>,
pub indexes: Vec<IndexDecl>,
pub trees: Vec<TreeDecl>,
pub units: Vec<UnitsDecl>,
}Expand description
One parsed model file.
Fields§
§mounts: Vec<Mount>mount NAME: target; — sources the model opens itself.
nodes: Vec<NodeDecl>node /container/role: query; — derived containers.
refs: Vec<RefDecl>ref PATH::field --> container; — scoped references.
rels: Vec<RelDecl>rel SOURCE -> TARGET[cond]; — node-to-node relations.
edges: Vec<EdgeDecl>edge PATH: ::a -- ::b; — pair edges between containers.
defs_text: Stringdef/macro statements, verbatim, joined with ; — seeded
into every constructor query’s fragment table.
aliases: Vec<AliasDecl>alias statements: other spellings a node’s name or trait
answers to (an alias is a way in, never a way
out; locators and reflection keep the canonical spelling).
traits: Vec<TraitDecl>trait <name>: STEP; — declared traits: a node carries
name exactly when it would match STEP as a step of a path,
decided at the node. In declaration order; a declaration may
use the traits declared before it.
indexes: Vec<IndexDecl>index SCOPE::prop; — properties the model keeps an index
of over the scoped nodes, for the searches by value (=>,
<--(SCOPE::prop)) whose scope is the declared one. Cost
only: the answer is the walk’s, with or without it.
trees: Vec<TreeDecl>tree IDENTITY: PATH; — the string other trees refer to this
one by, and the path (a mount root or a node inside one) the
tree stands at. An identity ending in a separator is a base.
units: Vec<UnitsDecl>units LIBRARY; — a kaiv .faiv unit library imported into
the unit table the unital reading consults, for every source
the model mounts: every spelling it lists reads, output
prints the primary name. A relative path is joined to the
model file’s directory.
Implementations§
Source§impl Model
impl Model
Sourcepub fn reachable_roots(&self, named: &[&str]) -> Vec<String>
pub fn reachable_roots(&self, named: &[&str]) -> Vec<String>
The mounts a query over named may reach through the
model’s declarations, named included: a ref from a scope
in one mount to a container or path in another, a rel
from a source to a target, and every mount a tree
declaration stands in (a reference by identity may come from
anywhere). Pure: a replay plan prefetches these before the
cells run. Unanchored declarations (//x) add nothing they
cannot name.