Skip to content
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

Implement Deserializer for Table and Array #367

Closed
Alxandr opened this issue Nov 2, 2022 · 2 comments · Fixed by #468
Closed

Implement Deserializer for Table and Array #367

Alxandr opened this issue Nov 2, 2022 · 2 comments · Fixed by #468
Labels
A-serde Area: Serde integration C-enhancement Category: Raise on the bar on expectations

Comments

@Alxandr
Copy link

Alxandr commented Nov 2, 2022

I'm writing a config system for a CLI application based in TOML. The top layer is always a Table, but in order to use the Deserializer implementation in Value, I currently have to store a Value instead (meaning I then have to do something like as_table().unwrap() in all the other methods).

@epage
Copy link
Member

epage commented Nov 2, 2022

I'd be willing to deserialze tables at the toml crate level but we can't guarantee that we can deserialize an Array.

@Alxandr
Copy link
Author

Alxandr commented Nov 8, 2022

Note, I was looking for Deserializer, not Deserialize. I found out however that they are mostly just aliases to std types, so I've made newtype wrappers instead so that I can implement traits on the types. That way I've been able to impl<'de> Deserializer<'de> for &'de MyNewType.

@epage epage added A-serde Area: Serde integration C-enhancement Category: Raise on the bar on expectations labels Jan 18, 2023
epage added a commit to epage/toml_edit that referenced this issue Jan 19, 2023
With toml-rs#457, we've started to make a harder distinction between documents and
values in `de`.  We are looking to do similar for `ser` which requires us to do
this for `Table`/`Value` as well.

Fixes toml-rs#367
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-serde Area: Serde integration C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants