Wado

core:kiln

Kiln stdlib entry point.

Import the user-facing Kiln types and the KilnHost effect via use { ... } from "core:kiln". This facade re-exports the WIT-generated submodules under lib/core/kiln/ and adds the Wado-only Request<T> wrapper that generator authors write against.

See WEP 2026-04-12 (Kiln) §"The generator contract" and §"Options are a typed argument in each generator's own world".

Functions

pub fn read_all(content: Stream<u8>) -> ByteList

Read an input file's content to the end. A generator that needs the whole file calls this; one that needs a prefix reads content itself and drops it early.

pub fn read_text(content: Stream<u8>) -> Result<String, Utf8Error>

Read an input file's content to the end as text, decoding as it goes so no second copy of the file exists. Err is a malformed input, not a bug.

Effects

pub interface KilnHost

Host interface exposed to Kiln generators. Deliberately narrow: a generator reports diagnostics and nothing else. Its inputs arrive by value, so it needs no filesystem, no clocks, no random, no network. See WEP 2026-04-12 (Kiln) §"The generator contract".

fn emit_diagnostic(diagnostic: Diagnostic)

#[cm("core:kiln/kiln-host@0.1.0#emit-diagnostic")] #[cm_params("diagnostic")]

Report a diagnostic that will be surfaced as a normal compile diagnostic. Multiple diagnostics may be reported; they are all printed even if the generator eventually returns a successful response.

Structs

pub struct NoOptions

The options type of a generator that takes no configuration. It is the default type argument of Request, so a generator with no Options struct writes fn generate(req: Request) and never mentions options. Its CBOR wire form is the empty map, which decodes back into NoOptions.

pub struct Request<T = NoOptions>

The typed request a Kiln generator receives. Generator authors write export fn generate(req: Request<Options>) -> Result<Response, Error> (or Request for a no-options generator).

Request<T> is Wado-only sugar and never crosses the WIT boundary as a single record: a generic cannot be expressed in a fixed WIT world (that is why generators do not share one world). The compiler rewrites fn generate(req: Request<T>) into flat, typed parameters (primary: InputFile, inputs: List<InputFile>, module: String, options: T) in the generator's own synthesized world, then rebinds them into a Request<T> value so the author's body sees req unchanged. options crosses as a typed WIT argument, not a serialized blob. The #[compiler_item("kiln_request")] attribute is that rewrite's lookup anchor. T defaults to NoOptions, so a generator that takes no options writes fn generate(req: Request). See WEP 2026-04-12 §"Options are a typed argument in each generator's own world".

primary: InputFile

inputs: List<InputFile>

module: String

How the use site named this generator: its module: specifier as written, or for a path, that path from the project root.

options: T

pub struct SourceSpan

A span into one of the files the generator received, identified by the same path that file carried. The compiler renders the snippet by consulting CompilerHost.

path: String

byte_start: u32

byte_end: u32

pub struct Diagnostic

level: DiagnosticLevel

span: Option<SourceSpan>

message: String

pub struct InputFile

One schema file the compiler opened for the generator. The set of files is fixed by the invocation declaration; the content arrives as a stream so a generator reads only as far as it needs.

path: String

content: Stream<u8>

pub struct OutputFile

One generated Wado file. path is relative to the invocation's output directory (defaults to build/kiln/<invocation-name>/). Exactly one output file must be the entry module; supplementary files are referenced from the entry via ordinary Wado use.

path: String

content: String

is_entry: bool

pub struct Response

files: List<OutputFile>

Variants

pub variant Error

InvalidSchema(String)

Unsupported(String)

Other(String)

Enums

pub enum DiagnosticLevel

Error

Warning

Info

Hint