Skip to content

Commit 2612917

Browse files
IceSentryalradish
authored andcommitted
fix load_internal_binary_asset with debug_asset_server (bevyengine#7246)
# Objective - Enabling the `debug_asset_server` feature doesn't compile when using it with `load_internal_binary_asset!()`. The issue is because it assumes the loader takes an `&'static str` as a parameter, but binary assets loader expect `&'static [u8]`. ## Solution - Add a generic type for the loader and use a different type in `load_internal_asset` and `load_internal_binary_asset`
1 parent 4ef9d6b commit 2612917

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/bevy_asset/src/assets.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ macro_rules! load_internal_asset {
417417
let mut debug_app = $app
418418
.world
419419
.non_send_resource_mut::<$crate::debug_asset_server::DebugAssetApp>();
420-
$crate::debug_asset_server::register_handle_with_loader(
420+
$crate::debug_asset_server::register_handle_with_loader::<_, &'static str>(
421421
$loader,
422422
&mut debug_app,
423423
$handle,
@@ -455,7 +455,7 @@ macro_rules! load_internal_binary_asset {
455455
let mut debug_app = $app
456456
.world
457457
.non_send_resource_mut::<$crate::debug_asset_server::DebugAssetApp>();
458-
$crate::debug_asset_server::register_handle_with_loader(
458+
$crate::debug_asset_server::register_handle_with_loader::<_, &'static [u8]>(
459459
$loader,
460460
&mut debug_app,
461461
$handle,

crates/bevy_asset/src/debug_asset_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ pub(crate) fn sync_debug_assets<T: Asset + Clone>(
116116
///
117117
/// If this feels a bit odd ... that's because it is. This was built to improve the UX of the
118118
/// `load_internal_asset` macro.
119-
pub fn register_handle_with_loader<A: Asset>(
120-
_loader: fn(&'static str) -> A,
119+
pub fn register_handle_with_loader<A: Asset, T>(
120+
_loader: fn(T) -> A,
121121
app: &mut DebugAssetApp,
122122
handle: HandleUntyped,
123123
file_path: &str,

0 commit comments

Comments
 (0)