-
Notifications
You must be signed in to change notification settings - Fork 126
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
Please use Cow<'static, str>
for configuration, rather than String
.
#545
Comments
Thank you for your very well-written issue, @maypop-the-dragon! I agree that using Cow instead of String would be more ergonomic, especially if the confit setter methods would take Into<Cow> as a parameter. The lifetime of the Cow is of course an important question. With ‘static we’d allow the optimisation only for const config values, which should cover most cases. Dynamic values would still need to allocate, but by keeping the Cow const we’d not have to add any new lifetime bounds. Overall, I like this idea! Do you want to open a PR yourself with this change? I’m very swamped myself atm. |
@juntyr, this is my first time doing this, so I might need help. |
Oops! Sorry, I clicked the wrong button! Again, first time. |
Just as a note but if this is done and |
Please use
Cow<'static, str>
for configuration, rather thanString
.This way, we will not have to allocate new
String
s all the time even when the strings are always the same.This will also make it possible to construct configurations in
const
contexts.This will allow for cleaner code and slightly improved performance.
How it is now:
How I imagine it could be:
P.S. This is my first GitHub issue so sorry if it's, like, bad somehow.
The text was updated successfully, but these errors were encountered: