Skip to main content

register_structured_option

Function register_structured_option 

Source
pub fn register_structured_option(
    registry: &ConfigRegistry,
    name: &str,
    schema: ConfigSchema,
    default: ConfigValue,
    doc: &str,
) -> Result<(), String>
Expand description

TC.3 — register an option whose value has structure.

The schema-taking peer of register_plugin_option. Kept here, beside it, because the two share every rule that is not about shape: auto-namespacing (the caller has already applied it), the name-collision refusal, and registering NOTHING when the declaration is bad.

The default is validated against the schema BEFORE registration for the same reason build_and_register parses before it allocates: a plugin whose own default does not fit its own declaration must get an error, not an option that exists and cannot hold a legal value — its later reads would then silently answer with a value nobody chose, which is the failure class this whole design is trying to end.