Using derive_builder
to avoid repetition with the builder pattern
#109
Labels
enhancement
New feature or request
When I was reading the code in
src/oauth.rs
andsrc/client.rs
I 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_builder
crate 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&str
for 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&str
it will just be cloned. This is also supported byderive_builder
.The text was updated successfully, but these errors were encountered: