Skip to main content

Module core

Module core 

Source
Expand description

The processing framework of the library: the values a feature declares itself with, and the machinery that turns those declarations into a registry, a plan and a run over a document.

Where crate::model describes what a document is made of, this module describes what the library does with one. A feature (FlmFeature) is a Rust value that contributes a related bundle of things to a registry (elements, stages, tables, lowering rules, backends, services, settings) through the feature builder (FeatureBuilder). A stage is a unit of work, a table is typed data that a stage writes, and a capability is a named state of processing. A feature can also declare outputs (named results a caller asks for, OutputDef). The registry records and checks those declarations once; a plan chooses the stages that satisfy what a caller asks for; a run executes one plan over one document. Every item a feature author implements or declares in that process is defined in a submodule of this module.

The submodules:

  • stage — the two kinds of stage (Stage and RewriteStage) and the values that describe a stage: its declaration, its needs for one plan, and the plan’s record joining both.
  • data — tables: their identity, and the store that holds the tables of one run.
  • services — service slots and the values features contribute to them.
  • lowering — lowering rules: the trait a rule implements, what it declares, and the Lowerer, the interface it works through.
  • artifact — artifacts (one file’s worth of output held as a value), the artifact set of one output, and the naming service a host supplies.
  • piece — pieces: the declaration of a document-level value that a backend places before or after the document’s content, and the table type that holds its content.
  • region — output regions: the named parts an output’s entry artifact is made of, which the backend’s final stage or a host’s template assembles.
  • registry — features, the registry builder, the checks of the registry build, and the frozen registry.
  • settings — settings written as data: a feature’s declaration of its settings, and how they are read into the feature’s Rust types.
  • plan — plan requests, the choice of stages and lowering rules, and the checks of a plan.
  • run — runs, the runner, the contexts a stage reads through, value catch-up, and the tables a caller installs when a run is constructed.

§Position in the crate’s layering

The modules of the crate are layered as the crate documentation describes, and a module uses only the layers below its own:

{model, lang} < core < dump < stdlib < math_passthrough        layout standalone

This module uses crate::model and crate::lang, and neither of those uses this module; crate::dump, crate::stdlib and crate::math_passthrough use it. Within this module, data is the lowest level: it uses crate::model and a few types of crate::lang, and no other submodule of core.

Modules§

artifact
Artifacts: one file’s worth of output held as a value, the artifact set that makes up one output, and the naming service a host supplies to turn an artifact’s identity into a path.
data
Computed data: the typed tables that pipeline stages write beside the frozen trees, and the store that holds them during a run.
lowering
Lowering rules: what a lowering rule is, what it declares, and the interface through which it builds the presentation of one element for one backend.
piece
Pieces: document-level synthesized values that a backend places before or after the document’s content. This module holds the declaration of a piece (PieceDecl, PiecePlace) and the type of its content (Piece).
plan
Building a plan: working out which stages run, and in which order, from what a caller asks for.
region
Output regions: the named parts an output’s entry artifact is made of, the table in which a backend writes them, and a backend’s statement that its output is made of them.
registry
FLM’s registry: the frozen record of everything a set of features declares, the features and the builder through which they declare it, and the build that checks the declarations and freezes them.
run
Running a plan over a document: the Run, the contexts through which stages read what they need while they run, and the data that a caller installs into a run from outside.
services
Services: values that one feature supplies for another feature, or for the program embedding the library, to use, and the service slots through which they are declared, supplied and read.
settings
Settings are a feature’s configuration and option values written as data, one map per feature from key to value, which this module reads into the feature’s own Rust types; a settings key is one field of those types.
stage
Stages: the units of work a plan schedules, and the values that describe them.