Skip to main content

Crate lattice_config_macros

Crate lattice_config_macros 

Source
Expand description

Proc-macro front-end for lattice-config’s declarative option / group / overrides declarations (M.2.0+M.2.1, Design B + D from docs/dev/architecture/mode-architecture.md discussion notes).

Three public macros:

  • options! — declares one or more typed options, each bound to a registered OptionGroup. Supports doc-comment capture, #[aliases("...")], #[validate(fn_path)], #[name("...")] (explicit display-name override), and #[customizable(bool)]. Self-registers each option via linkme::distributed_slice so the registry’s pre-main boot walks the slice and inserts every option without a central register_core_options call.

  • groups! — declares one or more OptionGroup types. Emits a compile-time const fn byte-walk assertion that each group’s display name does NOT end in -mode (the modes-vs-groups disambiguation rule, mode-architecture.md §6.7.1).

  • overrides! — constructs a typed OptionOverrideSet from a list of OptionDecl = value pairs (M.2.1). Compile-time-checks that each value matches its declaration’s Value type via a let-ascription intermediate. Optional #[priority(High)] / #[priority(Low)] attribute promotes individual entries. Used by Mode::options() impls.

Both macros emit code that references absolute paths into ::lattice_config; the consumer crate must depend on lattice-config. The host crate (lattice-config itself) uses extern crate self as lattice_config; so the same absolute paths resolve in its own code.

Macros§

groups
Declarative group declaration block. See lattice_config::OptionGroup and lattice_config::groups! for the surface contract.
options
Declarative option declaration block. See the trait doc on lattice_config::OptionDecl and the macro doc on lattice_config::options! for the surface contract.
overrides
Construct a typed OptionOverrideSet for a Mode::options() return.