mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-26 07:55:55 +03:00
[GH-ISSUE #109] Using derive_builder to avoid repetition with the builder pattern #35
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#35
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 @marioortizmanero on GitHub (Aug 13, 2020).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/109
Originally assigned to: @marioortizmanero on GitHub.
When I was reading the code in
src/oauth.rsandsrc/client.rsI couldn't help but notice all the boilerplate and repetition needed to implement builder patterns for some of the structs declared.I think this would be a great opportunity to use the
derive_buildercrate in order to have the codebase more maintainable, easier to read, and consistent. Read more about the features it provides here.The downside is possibly longer compilation times, but after improving this part in the latest commits I wouldn't think it's much of a problem. And I would like to compare the compilation times before and after the changes before this is merged into master to see how much of a difference there actually is.
Furthermore, using
From<String>instead of&strfor the builder parameters like this one would avoid an extra allocation for whenever the user passes aString, since theto_owned()can be omitted, and it will be directly moved into the struct. If the user passes a&strit will just be cloned. This is also supported byderive_builder.