Skip to main content

Module model

Module model 

Source
Expand description

The in-memory shape of a model: nodes, links, and the graph that holds them. Mirrors spec/FORMAT.md section 2. Nothing here reads files; that is the parser’s job.

Structs§

Graph
The whole model: every node, looked up by id. BTreeMap again, so iteration is in id order, which is exactly the order the spec requires for output.
Link
A typed, directed edge. It is stored on the node it starts from; the target is only an id. Holding an id (a String) instead of a reference to the target Node avoids self-referential structs, which Rust’s ownership rules make painful.
Node
One file of the model: a node with its front matter, links and markdown body.

Type Aliases§

Fields
Free-form key/value data. BTreeMap (not HashMap) keeps keys sorted, which makes our output deterministic, and the fixtures compare output exactly.