Skip to content

Commit

Permalink
Merge pull request #825 from slivingston/update-docs
Browse files Browse the repository at this point in the history
docs(readme): Update example to prefer DocumentMut
  • Loading branch information
epage authored Jan 18, 2025
2 parents a07313e + 017a74d commit e92c3b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/toml_edit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ relative order* of items.
## Example

```rust
use toml_edit::{Document, value};
use toml_edit::{DocumentMut, value};

fn main() {
let toml = r#"
"hello" = 'toml!' # comment
['a'.b]
"#;
let mut doc = toml.parse::<Document>().expect("invalid doc");
let mut doc = toml.parse::<DocumentMut>().expect("invalid doc");
assert_eq!(doc.to_string(), toml);
// let's add a new key/value pair inside a.b: c = {d = "hello"}
doc["a"]["b"]["c"]["d"] = value("hello");
Expand Down

0 comments on commit e92c3b6

Please sign in to comment.