Skip to main content

Module data

Module data 

Source
Expand description

Loading a program’s data (docs/data-input.md).

A program’s manifest (Program::inputs) says what it reads. The host opens each input through a Resolver, which decides what a path means and whether it may be read at all. This module reads the bytes, within InputLimits, and turns them into values of the declared types. The engine never touches files: it gets the values as Inputs, which only load makes, and checks they’re for the program it runs.

Structs§

InputLimits
Limits on loading data, for all of a program’s inputs together.
Inputs
What was read for a program: the value of each input, and where they came from. Only load makes these, and the engine checks that they’re for the program it runs.
Snapshots
The bytes read so far, by identity. A load reads each identity once; kept between loads, snapshots keep the data the same. The REPL, which runs its whole session again after each input, keeps them until :reload, so that earlier bindings don’t change under it.
SourceInfo
A file, or standard input, that was read.

Traits§

Resolver
How a host gives a program its data. A program only names paths: what they refer to, and whether they may be read, is the host’s policy, and a program can’t widen it.

Functions§

load
Read every input of program, through resolver. Errors are about the input’s read(…) call, and say where in the data they are.
suggest
Suggest a declaration, and the read that uses it, for the data in bytes, read from file in format.