Derive Macro ConfigShape
#[derive(ConfigShape)]
{
// Attributes available to this derive:
#[shape]
}
Expand description
Derive ConfigShape for a struct
with named fields, or for an enum whose variants are all unit.
A struct becomes a record; each field’s schema is its type’s, its doc is
its /// comment, and its required comes from the TYPE — an Option<T>
field is optional and everything else is required. That is the reason there
is no #[shape(optional)] attribute: the type already says it, and a second
place to say it is a second place to disagree.
An all-unit enum becomes an enum-of over its variants kebab-cased, which is
the spelling :set completion and :customize show. A data-carrying variant
is rejected rather than flattened — a tagged union has no config-schema
arm, and inventing one silently would produce a shape the host validates
against wrongly.
Field names cross kebab-cased, matching the option-name convention
(todo-keywords, not todo_keywords) so a TOML key reads the way every
other key in the file does.