-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set_dotted(true) on InlineTable doesn't work as expected #233
Comments
Thinking about this, what's the difference between dotted |
i don't feel confident that i can help clear up the definitions, but i'd like to make my expectations explicit: [nixpkgs]
src.git = "https://git" i'm also wondering which table is considered dotted here 🤔 it seems to be a property of the keys in the nixpkgs table rather than in the src table. |
[nixpkgs]
src.git = "https://git" This is the expected output. And this code works: use toml_edit::*;
fn main() {
let mut d = Document::new();
d["nixpkgs"] = table();
d["nixpkgs"]["src"] = table();
d["nixpkgs"]["src"].as_table_mut().unwrap().set_dotted(true);
d["nixpkgs"]["src"]["git"] = value("https://github.com/nixos/nixpkgs");
println!("{}", d);
} |
This is a TOML property, so EDIT: actually TOML spec talks about dotted keys, not tables. But I in terms implementation, it might be harder to implement as a property of keys. |
Ease of implementation :) A dotted key in a standard table can have standard tables nested under it [fruit]
apple.color = "red"
apple.taste.sweet = true
# [fruit.apple] # INVALID
# [fruit.apple.taste] # INVALID
[fruit.apple.texture] # you can add sub-tables
smooth = true But you can't do that with Inline Tables. And the way the divide is currently implemented generally makes it easier to convert the data back to a string. I do have an idea that might allow us to fix this. |
Before, we ignored the dotted-ness of it Fixes toml-rs#233
Before, we ignored the dotted-ness of it Fixes #233
prints
The text was updated successfully, but these errors were encountered: