feat(toml_edit): Implement IntoDeserializer for Item#846
Conversation
|
From https://github.com/toml-rs/toml/blob/main/CONTRIBUTING.md
For example, its not clear why you specifically want |
|
Sorry, I should have created an issue first, or at least explained clearly what I wanted to do in the PR. I want to parse the toml: # ...
[editor]
mouse = true
theme = "onedark"
# ...into a struct: #[derive(serde::Deserialize)]
struct Editor {
mouse: bool,
theme: String,
}Config parsing is part of the system, and elsewhere in the system there is already a |
Pull Request Test Coverage Report for Build 14008023700Details
💛 - Coveralls |
|
After refreshing myself on this code and the motivations for its design, my concerns are
Also, is there a reason you are using |
In my case, I don't need them since I don't need to know the specific type of the content, and I just need to know it's an
Makes sense, I will try to refactor it - I will set the PR as draft until I complete the refactoring (expected in the next day or two).
|
I'm trying to look for the principles of what the API should be, not handle one off cases. |
|
My knowledge of API design is very limited, so I might not be the right person to answer this. Before finding such principles, is there any chance of accepting this one-off PR? If not, I can close it - or I can create a separate issue for discussion if that would help. It's all up to you :) |
|
Hey @epage, I have separated Let me know if there are any other changes needed. |
| } | ||
|
|
||
| impl ValueDeserializer { | ||
| pub(crate) fn new(input: crate::Item) -> Self { |
There was a problem hiding this comment.
Perhaps it would be better to change crate::Item to crate::Value here, but I'm not sure if we should introduce more unrelated changes, as it might make the review more difficult.
If you prefer, I can make this change in a new commit or a separate refactor PR.
I'm working on a config parser based on
toml_editthat requires the implementation ofIntoDeserializerfor interoperability withserde.I noticed that
toml_edit::Itemalready has aninto_deserializer()method, but it's not public. So, this PR exposes it by implementing theIntoDeserializertrait.