bevyengine / bevyengine/disqualified
`get_short_name` should return a `Cow` most likely
- Dominant language
- Rust
- Stars
- 12
- Forks
- 4
- Avg merge
- 4h 23m
- Merged PRs (30d)
- 4
Description
## What problem does this solve or what need does it fill?
`bevy_utils::get_short_name` returns a `String`. This results in unconditional allocation, even if the short name can be expressed as a slice of the full name.
## What solution would you like?
Returning a `Cow` (similarly to how [`from_utf8_lossy`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.from_utf8_lossy) works) would reduce allocation.
## What alternative(s) have you considered?
Sometimes, `get_short_name` is used for debug/display purposes. We could also provide a wrapper type that specifically implements `Display` for `&str` with the `get_short_name` heuristic to remove all type prefixes.
## Additional context
I saw a "hand made" version of `get_short_name` in a `fmt::Debug` impl in asset_v2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.