-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Open
Labels
C-FeatureA new feature, making something new possibleA new feature, making something new possibleS-Needs-TriageThis issue needs to be labelledThis issue needs to be labelled
Description
What problem does this solve or what need does it fill?
AssetPath::resolve and AssetPath::resolve_embed accept &str and parse it internaly. But if you already have AssetPath, it's wasteful to call .to_string and let resolve parse it again:
bevy/crates/bevy_asset/src/path.rs
Lines 424 to 428 in 8813c18
| if let Some(label) = path.strip_prefix('#') { | |
| // It's a label only | |
| Ok(self.clone_owned().with_label(label.to_owned())) | |
| } else { | |
| let (source, rpath, rlabel) = AssetPath::parse_internal(path)?; |
What solution would you like?
Accept &AssetPath instead of &str in AssetPath::resolve looks like a better API to me.
What alternative(s) have you considered?
Add _str suffix to the current methods and and new methods that accept &AcceptPath.
Metadata
Metadata
Assignees
Labels
C-FeatureA new feature, making something new possibleA new feature, making something new possibleS-Needs-TriageThis issue needs to be labelledThis issue needs to be labelled