mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-26 07:55:55 +03:00
[PR #317] [MERGED] Deserialize Id types via an ephemeral string slice instead of one borrowed from the input #393
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#393
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?
📋 Pull Request Information
Original PR: https://github.com/ramsayleung/rspotify/pull/317
Author: @semicoleon
Created: 5/21/2022
Status: ✅ Merged
Merged: 5/23/2022
Merged by: @ramsayleung
Base:
master← Head:borrowed-id-str📝 Commits (1)
2af2f4bDeserialize Id types via an ephemeral string slice instead of one borrowed from the input📊 Changes
2 files changed (+46 additions, -23 deletions)
View changed files
📝
rspotify-model/src/idtypes.rs(+10 -3)📝
tests/test_models.rs(+36 -20)📄 Description
Description
Call deserialize_str instead of deserializing a &str directly
Closes #316
Motivation and Context
Currently the id types can only be deserialized when they can be borrowed directly from the input, but they don't actually need to have a long lived borrow of the string. The ephemeral &str from deserialize_str is sufficient.
Dependencies
N/A
Type of change
Please delete options that are not relevant.
How has this been tested?
I added a function to
test_models.rswhich calls both serde_json::from_str and serde_json::from_reader and replaced the calls to serde_json::from_str with it. I was originally asserting the outputs were equal buttest_current_playback_contextandtest_currently_playing_contextconsistently failed, possibly due to floating point imprecision?Is this change properly documented?
I'm not sure if this needs to be added to the changelog. It's relatively unlikely that anyone was hitting this issue in the first place.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.