-
Notifications
You must be signed in to change notification settings - Fork 3
Open
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 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels