You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
What problem does this solve or what need does it fill?
bevy_utils::get_short_name
returns aString
. 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 howfrom_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 implementsDisplay
for&str
with theget_short_name
heuristic to remove all type prefixes.Additional context
I saw a "hand made" version of
get_short_name
in afmt::Debug
impl in asset_v2The text was updated successfully, but these errors were encountered: