Skip to main content

set_document_value

Function set_document_value 

Source
pub fn set_document_value(
    doc: &mut DocumentMut,
    segments: &[&str],
    value: impl Into<Value>,
) -> Result<()>
Expand description

Set the value at segments (parent tables plus the final key), creating missing intermediate tables. Replacing an existing value keeps its decor, so comments above the key and trailing same-line comments survive.

Segments are separate strings rather than one dotted key, so table names that need quoting ([providers."my.provider"]) resolve correctly.