pub struct Program {
pub db: FileDb,
pub graph: Option<Graph>,
pub roots: Vec<Root>,
pub runs: bool,
pub diagnostics: Vec<Diagnostic>,
}Expand description
What to load (spec §4.4).
Fields§
§db: FileDbEvery manifest the graph read. The loader adds every source file.
graph: Option<Graph>None for a loose program, or when the root’s manifest cannot be
read or parsed.
roots: Vec<Root>The entry first.
runs: boolWhether MIR runs: the entry is src/main.nova, or a loose file.
diagnostics: Vec<Diagnostic>The graph’s diagnostics.
Implementations§
Source§impl Program
impl Program
Sourcepub fn loose(path: &Path) -> Program
pub fn loose(path: &Path) -> Program
A loose program: path, and the files beside it that it imports.
Sourcepub fn for_file(path: &Path) -> Program
pub fn for_file(path: &Path) -> Program
The program whose entry is path (spec §4.1). It is a module of its
package when it is directly in a package’s src/ or tests/, and
otherwise loose, reading no manifest.
Sourcepub fn for_package(root: &Path, roots: Roots) -> Program
pub fn for_package(root: &Path, roots: Roots) -> Program
The package whose nova.toml is in root (empty for the current
directory), with the roots roots names that exist.
Sourcepub fn for_package_in(root: &Path, roots: Roots, offline: &Offline) -> Program
pub fn for_package_in(root: &Path, roots: Roots, offline: &Offline) -> Program
Program::for_package, with registry packages found as offline
says (spec 3.3b §5.4): tests pass the registry directory, and
publishing’s verification reads no dev-dependencies.
Sourcepub fn doc_tests(package: Option<&Path>, paths: Vec<PathBuf>) -> Program
pub fn doc_tests(package: Option<&Path>, paths: Vec<PathBuf>) -> Program
A program of doc tests (spec 3.5b §5, §6.2), each of paths a
RootKind::Doc root, read through the Sources given to
build_test_program_with: of the package whose nova.toml is in
package, or of no package for std’s (None).
A package’s library, src/lib.nova, is a root after them. The
loader then reads it under the path the root names, as nova doc‘s
analysis does, rather than the one an import names, which differs on
Windows under an empty root; a diagnostic’s map finds the library in
the database by that name (spec 3.5b §7). The first doc test stays
the entry, which names the binary apart from the unit tests’.
With no paths there is no root, and a build fails with “nothing
to compile” rather than build the library’s own tests.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Whether the graph found an error.