Skip to main content

toml_to_config_value

Function toml_to_config_value 

Source
pub fn toml_to_config_value(value: &Value) -> Result<ConfigValue, SchemaError>
Expand description

TC.2 — a TOML value as a ConfigValue tree.

Pure and schema-blind: it answers “what shape is this”, and crate::schema::validate answers “is that the right shape”. Keeping the two apart is what lets the shape error and the schema error carry the same kind of path.

Floats and datetimes are refused rather than stringified. ConfigValue has no kind for either, and quietly turning 1.5 into "1.5" would make an option’s value depend on the host’s float formatter — the sort of thing that works until a locale or a plugin language disagrees. Adding a kind later is additive; guessing now is not.