Skip to main content

flm_core/core/
mod.rs

1//! The processing framework of the library: the values a feature declares
2//! itself with, and the machinery that turns those declarations into a
3//! registry, a plan and a run over a document.
4//!
5//! Where [`crate::model`] describes what a document is made of, this module
6//! describes what the library does with one. A feature
7//! ([`FlmFeature`](registry::FlmFeature)) is a Rust value that contributes a
8//! related bundle of things to a registry (elements, stages, tables, lowering
9//! rules, backends, services, settings) through the feature builder
10//! ([`FeatureBuilder`](registry::FeatureBuilder)). A stage is a unit of work, a
11//! table is typed data that a stage writes, and a capability is a named state
12//! of processing. A feature can also declare outputs (named results a caller
13//! asks for, [`OutputDef`](registry::OutputDef)). The [registry] records and
14//! checks those declarations once; a [plan](plan::Plan) chooses the stages
15//! that satisfy what a caller asks for; a [run](run::Run) executes one plan
16//! over one document. Every item a feature author implements or declares in
17//! that process is defined in a submodule of this module.
18//!
19//! The submodules:
20//!
21//! - [`stage`] — the two kinds of stage ([`Stage`](stage::Stage) and
22//!   [`RewriteStage`](stage::RewriteStage)) and the values that describe a
23//!   stage: its declaration, its needs for one plan, and the plan's record
24//!   joining both.
25//! - [`data`] — tables: their identity, and the store that holds the tables of
26//!   one run.
27//! - [`services`] — service slots and the values features contribute to them.
28//! - [`lowering`] — lowering rules: the trait a rule implements, what it
29//!   declares, and the [`Lowerer`](lowering::Lowerer), the interface it works
30//!   through.
31//! - [`artifact`] — artifacts (one file's worth of output held as a value),
32//!   the artifact set of one output, and the naming service a host supplies.
33//! - [`piece`] — pieces: the declaration of a document-level value that a
34//!   backend places before or after the document's content, and the table type
35//!   that holds its content.
36//! - [`region`] — output regions: the named parts an output's entry artifact
37//!   is made of, which the backend's [final
38//!   stage](crate::guide::concepts_overview#output-regions-and-the-final-stage)
39//!   or a host's template assembles.
40//! - [`registry`] — features, the registry builder, the checks of the registry
41//!   build, and the frozen registry.
42//! - [`settings`] — settings written as data: a feature's declaration of its
43//!   settings, and how they are read into the feature's Rust types.
44//! - [`plan`] — plan requests, the choice of stages and lowering rules, and the
45//!   checks of a plan.
46//! - [`run`] — runs, the runner, the contexts a stage reads through, [value
47//!   catch-up](crate::guide::concepts_overview#value-catch-up), and the tables
48//!   a caller installs when a run is constructed.
49//!
50//! # Position in the crate's layering
51//!
52//! The modules of the crate are layered as the [crate
53//! documentation](crate) describes, and a module uses only the layers below
54//! its own:
55//!
56//! ```text
57//! {model, lang} < core < dump < stdlib < math_passthrough        layout standalone
58//! ```
59//!
60//! This module uses [`crate::model`] and [`crate::lang`], and neither of those
61//! uses this module; [`crate::dump`], [`crate::stdlib`] and
62//! [`crate::math_passthrough`] use it. Within this
63//! module, [`data`] is the lowest level: it uses [`crate::model`] and a few
64//! types of [`crate::lang`], and no other submodule of `core`.
65
66pub mod artifact;
67pub mod data;
68pub mod lowering;
69pub mod piece;
70pub mod plan;
71pub mod region;
72pub mod registry;
73pub mod run;
74pub mod services;
75pub mod settings;
76pub mod stage;