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

From<std::borrow::Cow> for KeyName #377

Closed
mooso opened this issue Jun 1, 2023 · 2 comments
Closed

From<std::borrow::Cow> for KeyName #377

mooso opened this issue Jun 1, 2023 · 2 comments
Labels
C-core Component: core functionality such as traits, etc. E-simple Effort: simple. T-enhancement Type: enhancement. T-ergonomics Type: ergonomics.

Comments

@mooso
Copy link
Contributor

mooso commented Jun 1, 2023

We have a use case to have semi-dynamic names for some metrics, and it'd be great if KeyName could impl From<std::borrow::Cow> so that we construct the key name once (at runtime) and then cheaply emit metrics using that without reallocating every time. Unless I'm missing something that should be easy enough since SharedString (the crate's Cow) already has impl From<std::borrow::Cow<'static, str>>. Will be happy to craft a PR for this unless I hear objections. Thanks!

@tobz
Copy link
Member

tobz commented Jun 1, 2023

Hmm, weird. Surprised I never added that impl. 🤔

Feel free to craft a PR. 👍🏻

@tobz tobz added C-core Component: core functionality such as traits, etc. E-simple Effort: simple. T-enhancement Type: enhancement. T-ergonomics Type: ergonomics. labels Jun 1, 2023
@tobz
Copy link
Member

tobz commented Jul 3, 2023

Closed via #378, released via [email protected].

@tobz tobz closed this as completed Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-core Component: core functionality such as traits, etc. E-simple Effort: simple. T-enhancement Type: enhancement. T-ergonomics Type: ergonomics.
Projects
None yet
Development

No branches or pull requests

2 participants