You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I'd like the table to not be inline, to get [patch."ssh://foo.bar"]. It seems that toml_edit::table() returns such a table, so I assumed .or_insert()ing it would work:
fnmain(){letmut x = toml_edit::DocumentMut::new();let patch = x["patch"]["ssh://foo.bar"].or_insert(toml_edit::table());// This table is _not_ inline
patch["my_crate"]["path"] = toml_edit::Item::Value("foo/baz/bar".into());println!("{}", x);}
Somewhat surprisingly, this does not seem to recursively insert an implicit table for patch, and the output is:
patch = {}
The only way I've found around this thus far is to insert another table on ["patch"].or_insert(...). However, to prevent an empty [patch] from showing up, this has to be marked as implicit with this rather verbose syntax:
Consider the following inexistant
patch."ssh://foo.bar"
table, that I'd like to fill with amy_crate
entry:It seems the
IndexMut
access here causes allNone
tables to be added, with an implicit moniker, which is neat:However, I'd like the table to not be inline, to get
[patch."ssh://foo.bar"]
. It seems thattoml_edit::table()
returns such a table, so I assumed.or_insert()
ing it would work:Somewhat surprisingly, this does not seem to recursively insert an implicit table for
patch
, and the output is:patch = {}
The only way I've found around this thus far is to insert another table on
["patch"].or_insert(...)
. However, to prevent an empty[patch]
from showing up, this has to be marked as implicit with this rather verbose syntax:With the desired output:
Is it expected that no implicit table was created for
patch
? If so, how about having atoml_edit::implicit_table()
helper or the like?Thanks!
The text was updated successfully, but these errors were encountered: