Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Add DrawFunctionsInternals::id() #6745

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
better error
  • Loading branch information
IceSentry committed Nov 24, 2022
commit e7de0020f8ac23f6d68cafaf3040c839359f4777
10 changes: 8 additions & 2 deletions crates/bevy_render/src/render_phase/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@ impl<P: PhaseItem> DrawFunctionsInternal<P> {
/// Fallible wrapper for [`Self::get_id()`]
///
/// ## Panics
/// if the id doesn't exist it will panic
/// If the id doesn't exist it will panic
pub fn id<T: 'static>(&self) -> DrawFunctionId {
self.get_id::<T>().expect("DrawFunctionId not found")
self.get_id::<T>().unwrap_or_else(|| {
panic!(
"Draw function {} not found for {}",
std::any::type_name::<T>(),
std::any::type_name::<P>()
)
})
}
}

Expand Down