Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

toml-rs can't read its own output if the root level object is a list #388

Closed
liljencrantz opened this issue Apr 15, 2020 · 2 comments
Closed

Comments

@liljencrantz
Copy link

Sending in a list of integers, e.g. toml::Value::from(vec![toml::Value::from(1), toml::Value::from(2)]) results in a serialized output like [1, 2].

But when trying to deserialize that same output, one gets the error Error: expected a right bracket, found a comma at line 1 column 3.

I don't know if the toml file format allows the root node to be a list or not, so I don't know if this is a bug in the serializer or the deserializer, but I think it's pretty clear that any output that toml-rs spits out, it should be able to read back in.

It should also be noted that if the root object is a list of tables, one gets even trippier output, like

[[]]
file = ".git"
modified = "2020-04-15T17:46:22.776979796+02:00"
size = 4096
type = "directory"
user = "liljencrantz"

[[]]
file = "todo"
modified = "2020-04-14T16:19:16.269954425+02:00"
size = 2020
type = "file"
user = "liljencrantz"

Not sure if that's how it's supposed to look.

@alexcrichton
Copy link
Collaborator

I believe this is a bug in the serialization here, really only toml tables can be considered a document to parse later, othrewise serialization is just fragments of a document and may not make sense. There's no way to deserialize a top-level array from a toml document.

@epage
Copy link
Member

epage commented Sep 23, 2022

Maintenance of this crate has moved to the https://github.com/toml-rs/toml repo. As a heads up, we plan to move toml to be on top of toml_edit, see toml-rs/toml#340.

Closing this out. If this is still a problem, feel free to recreate this issue in the new repo.

@epage epage closed this as completed Sep 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants