mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-26 07:55:55 +03:00
[PR #331] [MERGED] Implement Into<&'static str> for all enums #402
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#402
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/331
Author: @SabrinaJewson
Created: 6/15/2022
Status: ✅ Merged
Merged: 6/25/2022
Merged by: @marioortizmanero
Base:
master← Head:into-static-str📝 Commits (7)
88926aeImplementInto<&'static str>for all enums0c91853Update changelog2c21f32Merge branch 'master' into into-static-str5c6a229RemoveAsRef<str>implementations92637b3Update examples67b95b1Update Reqwest examples2efbbadUpdate changelog📊 Changes
12 files changed (+147 additions, -146 deletions)
View changed files
📝
CHANGELOG.md(+4 -0)📝
examples/auth_code.rs(+1 -1)📝
examples/ureq/search.rs(+9 -9)📝
rspotify-model/src/enums/country.rs(+2 -2)📝
rspotify-model/src/enums/misc.rs(+13 -13)📝
rspotify-model/src/enums/types.rs(+10 -10)📝
rspotify-model/src/recommend.rs(+2 -2)📝
src/clients/base.rs(+47 -50)📝
src/clients/oauth.rs(+28 -28)📝
tests/test_enums.rs(+12 -12)📝
tests/test_with_credential.rs(+3 -3)📝
tests/test_with_oauth.rs(+16 -16)📄 Description
Description
Derives both
AsRef<str>andInto<&'static str>(viaFrom<{the enum}> for &'static str) for all the enums.Note: there’s a
#[derive]in here thatrustfmtexplodes on to 13 lines. I don’t really like it but I also can’t separate the derives into two lines because rustfmt just merges them together again 😄Also makes
MarketCopy, just so I can avoid code duplication betweenAsRef<str>andFrom<Market> for &'static str.Motivation and Context
This makes the enums useful in more places, since the lifetime of the string is not actually tied to the lifetime of the enum.
Dependencies
None.
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration
cargo test -p rspotify-model🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.