Skip to main content

Crate harn_stdlib_catalog

Crate harn_stdlib_catalog 

Source
Expand description

Registration point for the embedded Harn standard library.

The compiler and runtime read stdlib sources through this crate instead of depending on harn-stdlib, which embeds every .harn source file. A crate that embeds the sources changes whenever one of them does, and so does everything compiled against it; keeping the catalog behind this small, dependency-free crate means editing a stdlib module rebuilds only harn-stdlib and the binaries that link it.

A host links harn-stdlib and calls harn_stdlib::install() once at startup. Reading the catalog before that is a typed CatalogNotInstalled error, never an empty standard library.

Structs§

CatalogAlreadyInstalled
A different catalog is already installed in this process.
CatalogNotInstalled
No stdlib catalog was installed before Harn code needed one.
StdlibCatalog
Every embedded stdlib source a host provides.
StdlibCliScript
Embedded .harn script that backs a CLI subcommand. Looked up by the harn-cli dispatch wedge (see harn#2293 epic and harn#2294 G1) so subcommands can ship in Harn instead of Rust.
StdlibPromptAsset
One embedded prompt template, addressed by its path under std/.
StdlibSource
One embedded stdlib module, imported as std/<module>.

Functions§

builtin_reexports
Builtins a stdlib module re-exports under its own name, so import { assert_eq } from "std/testing" resolves.
install
Install the process’s stdlib catalog. Installing the same catalog again is a no-op; a second, different catalog is refused.
installed
The installed catalog.