Skip to main content

toml_set_string

Function toml_set_string 

Source
pub fn toml_set_string(
    text: &str,
    section: &str,
    key: &str,
    value: &str,
) -> String
Expand description

Set [section] key = "value" in this TOML text and return the whole text back.

Everything the wizard does not ask about survives untouched — comments, ordering, other sections — because this rewrites one line rather than re-serialising the config. An uncommented line is replaced in place; a commented template line (# key = ...) becomes the real one; otherwise the key is added under the section header, and the section itself is appended if it was missing.