diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index c140f6247e46a..5aeceda9253e1 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -178,6 +178,18 @@ impl From<&str> for HandleId { } } +impl From<&String> for HandleId { + fn from(value: &String) -> Self { + AssetPathId::from(value).into() + } +} + +impl From for HandleId { + fn from(value: String) -> Self { + AssetPathId::from(&value).into() + } +} + impl From<&Handle> for HandleId { fn from(value: &Handle) -> Self { value.id diff --git a/crates/bevy_asset/src/path.rs b/crates/bevy_asset/src/path.rs index ffae39064d52d..df99eaee19da1 100644 --- a/crates/bevy_asset/src/path.rs +++ b/crates/bevy_asset/src/path.rs @@ -152,6 +152,12 @@ impl<'a> From<&'a str> for AssetPath<'a> { } } +impl<'a> From<&'a String> for AssetPath<'a> { + fn from(asset_path: &'a String) -> Self { + asset_path.as_str().into() + } +} + impl<'a> From<&'a Path> for AssetPath<'a> { fn from(path: &'a Path) -> Self { AssetPath {