I want to edit a key in a Toml file, and for the life of me I can't figure out how.
let codegen = &mut toml["profile"]["server-dev"];
if let toml_edit::Item::Table(t) = codegen {
if t.contains_key("codegen-backend-disabled") {
let Some((k,v)) = t.get_key_value_mut("codegen-backend-disabled");
*k = "codegen-backend"
// Change key
} else if t.contains_key("codegen-backend") {
return Ok(());
} else {
t["codegen-backend"] = value("cranelift");
}
}
This gives me these errors for the line where I try to change the key.
the size for values of type `str` cannot be known at compilation time
the trait `std::marker::Sized` is not implemented for `str`
the left-hand-side of an assignment must have a statically known size
mismatched types
expected `str`, found `&str`rustcClick for full compiler diagnostic
How do I change the key?