Skip to content

Commit

Permalink
Improve asset collection loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Indy2222 committed Feb 21, 2024
1 parent 56f542c commit 2b6a2cc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions crates/objects/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ where

/// Returns progress of the loading.
///
/// It shall not be called before [`Self::init`].
///
/// # Panics
///
/// Panics if loading any of the assets is either failed or unloaded.
/// Panics if loading any of the assets is either failed or unknown.
fn progress(&self, server: &AssetServer) -> Progress {
enum_iterator::all::<Self::Key>()
.map(
Expand All @@ -64,8 +66,12 @@ where
RecursiveDependencyLoadState::Loading => false.into(),
RecursiveDependencyLoadState::Loaded => true.into(),
},
// TODO is this correct?
None => false.into(),
None => panic!(
"Unknown asset: {}/{}.{}",
Self::DIRECTORY,
key.stem(),
Self::SUFFIX
),
},
)
.reduce(|a, b| a + b)
Expand Down

0 comments on commit 2b6a2cc

Please sign in to comment.