-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
A-AssetsLoad files from disk to use for things like images, models, and soundsLoad files from disk to use for things like images, models, and soundsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!X-UncontroversialThis work is generally agreed uponThis work is generally agreed upon
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
A-AssetsLoad files from disk to use for things like images, models, and soundsLoad files from disk to use for things like images, models, and soundsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!X-UncontroversialThis work is generally agreed uponThis work is generally agreed upon