Skip to main content

rename_key

Function rename_key 

Source
pub fn rename_key(t: &mut Table, from: &str, to: &str) -> bool
Expand description

Rename a key, keeping its place in the document and the decor it carried.

toml_edit has no rename. Removing and re-inserting would put the key at the end, and authoring order carries intent, so every entry is taken out in order and put back with the renamed one rebuilt under its new name. remove_entry hands back the Key itself, so the comments and whitespace attached to it come along.