Skip to main content

Model

Struct Model 

Source
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: String

def/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

Source

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.

Trait Implementations§

Source§

impl Clone for Model

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 Model

Source§

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

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

impl Default for Model

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

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.