Skip to main content

Module spec

Module spec 

Source
Expand description

A registry written back out as the spec’s config block.

A CLI declares its settings in code with #[derive(usage::Config)], and this is the way back out: the registry it derived, rendered as the config { prop … } block the spec grammar defines, so docs, JSON schema, completions and every other spec consumer read declarations made in Rust exactly as they read ones made in KDL.

Written by hand rather than through a KDL library for the same reason the argv crate’s spec writer is: this crate has no dependencies, and the grammar being emitted is the small fixed one the spec parser defines.

Structs§

ConfigSpec
Spec-only declarations generated from a settings struct.
PropSpec
Documentation-only metadata for one property.
SpecFile
A config file declaration. Slice order is ascending precedence.
SpecSource
A custom source declaration at the top of a spec’s config block.

Functions§

spec_kdl
The spec config block for these settings, as KDL.
spec_kdl_with
The complete spec config block, including metadata resolution does not use.