Skip to main content

scalar

Function scalar 

Source
fn scalar(y: &Yaml) -> Result<Option<String>, String>
Expand description

Every value Mira reads from the config file is a string — an address, a path, a name, a duration. So the rule is simply that it must have arrived as one.

Ok(None) means “no scalar here”: a missing key, an explicit null, or a collection — and a collection at a key Mira reads is refused by check_keys, which knows the path to name it by. Err means the key is present and the parser resolved it to some other type, which is the ambiguity KYAML exists to remove. Coercing back with to_string() is what makes 0x1f silently become 31; refusing costs the author two quote characters and cannot be wrong.