Expand description
Program: what a program is, and what a program file holds — its
steps, each an operation and its saved arguments, its state: where its
placed parts are and how its joints are turned, what solving it
changes — and how it is shown (Display). Serialized as
{"steps": [...], "state": {...}, "display": {...}}.
A step’s id names everything the step builds, so ids are unique in a
program and spelled in an alphabet a name can be built from
(validate_operation_id).
Structs§
- Display
- How what a program builds is shown, as the user chose, over what an editor shows by itself: a display state, saved with the program as the camera is not. Nothing a run reads: it builds the same part however it is shown.
- Program
- A program: its steps, the state it was saved with — what it is run
with: what a solve moves (see
Program::run) — and how what it builds is shown. - Program
Step - One step of a program: which operation, with which arguments, as saved, and whether it runs. The operation reads its arguments from their saved form each time it runs or is edited, so a program is plain data: it is copied for undo, compared for change, and saved as it is.
Functions§
- validate_
operation_ id - Checks that
idcan be an operation id: non-empty, and only ASCII letters, digits,_,-and.. Nothing that could be mistaken for the(,)and,that structure a name, so the names built from it stay unambiguous — nor dots alone: a part placed as..would be mistaken for the part placing it (crate::placed::OUTSIDE).