mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-26 07:55:55 +03:00
[GH-ISSUE #316] The Deserialize impl for the id types doesn't work correctly with serde_json::from_reader #97
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#97
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @semicoleon on GitHub (May 21, 2022).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/316
Describe the bug
When deserializing from an std::io::Reader instead of using serde_json::from_slice PlaylistIds (and the other id types, I assume) fail with
invalid type: string "...", expected a borrowed string. See a minimal reproduction here. The README on that repo also has a brief explanation of what I think is causing the problem based on a quick look at the Deserialize impl.To Reproduce
Steps to reproduce the behavior:
Expected behavior
serde_json::from_slice(data) == serde_json::from_reader(data) when the derserialized type impls DeserializeOwned
@ramsayleung commented on GitHub (May 21, 2022):
Oooh, thanks for your report, I can reproduce this problem. The compiler complains :
I agree with your point that the offending line is
let field = <&str>::deserialize(deserializer)?;atidtypes.rs:352,<&str>expects a borrowed string, but afrom_readerfunction may only deserialize owned data.If you have time, feel free to create a PR to fix this issue :)