Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Into<String> or ToString::to_string rather than requiring owned Strings up front. #168

Open
gibbz00 opened this issue May 9, 2024 · 2 comments · May be fixed by #169
Open

Use Into<String> or ToString::to_string rather than requiring owned Strings up front. #168

gibbz00 opened this issue May 9, 2024 · 2 comments · May be fixed by #169

Comments

@gibbz00
Copy link

gibbz00 commented May 9, 2024

Partly a question if there's any reason why the API requires owned strings for constructors and such.

.add_scope(Scope::new("read".to_string()))
.add_scope(Scope::new("write".to_string()))

Could then become:

.add_scope(Scope::new("read"))
.add_scope(Scope::new("write"))

And the method signature would still make it clear that an allocation will take place.

This also applies to the oath2 crate.

@ramosbugs
Copy link
Owner

See ramosbugs/oauth2-rs#248. I'd be open to the constructor methods accepting impl Into<String> in both crates for better ergonomics.

@gibbz00
Copy link
Author

gibbz00 commented May 11, 2024

Cool cool :) Might take a look at it when I have the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants