Skip to main content

Module workspace

Module workspace 

Source
Expand description

Workspace: where the programs a program places, and the files its steps read, come from — the one thing a run reads that is not given to it as inputs or state, and not built by its steps — and Files, a workspace of files read from a FileStore.

A program never knows where it is. The runner running it does (Location): the file it is in, and the files placing it. A make reads a file through its reader (crate::reader::Reader::read_file, crate::reader::Reader::program), which records the file’s revision (Workspace::revision): its node is made again exactly when the file changed.

Placing a part runs the program of another file, which may place parts of its own. So the files of a workspace form a graph, and it has to be acyclic: a file that places itself, directly or through others, would never finish building. The runner refuses such a placement with an error naming the cycle.

Files name each other by /-separated paths relative to the file doing the naming — bolt.geop, ../parts/bolt.geop — so a folder of files can be moved as a whole. resolve turns such a reference into the path a workspace knows the file by, relative goes back.

A file of a library every workspace shares — the standard parts an application offers — is named by a scheme instead: std:hex_nut.geop (see is_shared). Such a name means the same file from anywhere, so it is never relative.

Structs§

Files
A set of files, whose programs are written in the operations of registry: the Workspace its programs are run with, reading the programs they place and the files they import from it. A program read is checked against the operations (see Program::validate).
Location
Where the program a runner runs is: the file it is in, and the files placing it, outermost first — which it must not place again, or the files would place themselves. The runner’s to know, never the program’s.

Constants§

BYTES_PREFIX
What the content of a file of bytes that are not text starts with: a data: URL of them, in base64 (see content).

Traits§

FileStore
Where Files reads files from.
FileStoreMut
FileStore Files can change (Files::write).
Workspace
Programs and other files, by path.

Functions§

base64
bytes as base64 text (RFC 4648, padded).
bytes
The bytes of a file whose content is content (see content).
content
The content of a file of bytes, as a workspace holds it: a file holds text, so the text they spell where they are UTF-8 throughout, and otherwise — a binary STL, a STEP file with a Latin-1 name in it — a data: URL of them in base64. A front end reading a file a user chose holds it the same way, so files travel as text everywhere and only what reads bytes (bytes) or text (text) decodes them.
from_base64
The bytes of the base64 text text (RFC 4648, padded or not).
is_program
Whether the file path is a program, which a part can be placed from: a .geop file.
is_shared
Whether reference names a file of a library every workspace shares, by a scheme of two letters or more and : — std:hex_nut.geop. It names the same file from anywhere: it is never relative. (A single letter before the : is a drive, C:/parts/bolt.geop.)
relative
How the file from names the file to, both paths as resolve gives them: relative to the folder from is in — a shared library’s file by its own name (see is_shared).
resolve
The path of the file reference names, from the file from: relative to the folder from is in, unless it starts with / or is a shared library’s (see is_shared). . and .. are taken out where they can be, and \ read as /.
text
The text of a file whose content is content (see content): its bytes read as UTF-8, what is not replaced.