Comments (5)
Thinking about this, what's the difference between dotted InlineTable
and dotted Table
?
from toml.
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.
from toml.
[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);
}
from toml.
i'm also wondering which table is considered dotted here thinking it seems to be a property of the keys in the nixpkgs table rather than in the src table.
This is a TOML property, so src
is a table (dotted), and git
is the key of that table, see https://toml.io/en/v1.0.0 for details.
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.
from toml.
Thinking about this, what's the difference between dotted
InlineTable
and dottedTable
?
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.
from toml.
Related Issues (20)
- Fix u64 deserialization HOT 6
- Multi-line k/v pairs HOT 1
- Serialization of keys varies depending on whether the feature flag "parse" is enabled
- Array of Tables `remove` does not return the removed table
- Implement `From<inner type>` for `Item`
- Decor in `DocumentMut` is ignored HOT 2
- Feature proposal: Type-safe decor mutation API HOT 1
- Allow to create `Decor` instances with optional prefix or suffix
- How to serialize/deserialize while preserving formats with `toml_edit`? HOT 3
- [Bug] `de::from_str` has overly strict generic restrictions. HOT 1
- How to use `Spanned` HOT 1
- Missing output on `or_insert()`ing on a nested `Item::None` table HOT 3
- Function for inserting table key at ordinal in a `TableLike` HOT 1
- Bad span with untagged enum HOT 1
- Table::try_into / Value::try_into not working HOT 6
- Uneeded escapes with multiline string character escapes HOT 7
- Allow setting key's representation HOT 2
- Feature Request: get raw repr of key/value when deserializing HOT 5
- `toml_edit`: value is not written if table is constructed beforehand HOT 5
- Implement `Serialize` and `Deserialize` for `Date` and `Time` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toml.