Skip to main content

geop_core_program/
lib.rs

1//! What a program is: its steps and state ([`program`]), the values it is
2//! run with ([`values`]), the operations its steps are of ([`operation`],
3//! [`operation_registry`]), the part it builds ([`part`], [`target`],
4//! [`reader`], [`element`]), the parts of other programs it places
5//! ([`placed`]), how it is run ([`runner`]), the files around it
6//! ([`workspace`]) and what their texts were made into ([`cache`]), and numbers given as formulas of its parameters
7//! ([`numeric`]). It knows no operation: those are defined by the crates
8//! built on it, and no target type but a parameter's.
9//!
10//! # The run model
11//!
12//! A part is a memo table with one kind of node: what one step produced of
13//! one target, keyed by the step's id and the target's name, never by a
14//! position. A run walks the program's steps in order; each step only
15//! declares what it produces ([`part::StepContext::produce`]), with its
16//! arguments and a plain function, its make, that computes the value
17//! through a [`reader::Reader`]. Every read is recorded on the node
18//! ([`target::Read`]): which producer's version of a target, that a target
19//! was absent, the value of an input or of the state, a file's revision, a
20//! read inside a placed part.
21//!
22//! A make runs when its node is new, its arguments differ, or something it
23//! read changed; nothing else ever runs. A node made again into an equal
24//! value keeps its version, so what read it is reused in turn.
25//!
26//! The producer a step sees of a target is the latest step before it in the
27//! program's order that produces it. A target several steps produce — the
28//! model, the parameters' values — is a chain ([`target::Target::CHAIN`]):
29//! each producer starts from what the one before left
30//! ([`reader::Reader::previous`]). Inserting, removing or reordering steps
31//! changes which producer a reader sees, which the recorded reads catch.
32//!
33//! A placed part is a node whose value is a built part
34//! ([`placed::PlacedPart`]), built from exactly its program, its inputs and
35//! the slice of the state under its name; equal builds are shared, so a
36//! thousand equal screws are one build.
37
38// Library code reports what goes wrong as an error, never by panicking;
39// tests may unwrap.
40#![cfg_attr(
41    not(test),
42    deny(
43        clippy::unwrap_used,
44        clippy::expect_used,
45        clippy::panic,
46        clippy::indexing_slicing,
47        clippy::todo,
48        clippy::unimplemented,
49        clippy::unreachable
50    )
51)]
52
53pub mod cache;
54pub mod element;
55pub mod kept;
56pub mod numeric;
57pub mod operation;
58pub mod operation_registry;
59pub mod part;
60pub mod placed;
61pub mod program;
62pub mod reader;
63pub mod runner;
64pub mod target;
65#[cfg(test)]
66mod test;
67#[cfg(any(test, feature = "testing"))]
68pub mod testing;
69pub mod values;
70pub mod watch;
71pub mod workspace;