Skip to content

Add Self: Sized bounds to Bundle trait methods #14879

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
11 changes: 8 additions & 3 deletions crates/bevy_ecs/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@ pub unsafe trait Bundle: DynamicBundle + Send + Sync + 'static {
components: &mut Components,
storages: &mut Storages,
ids: &mut impl FnMut(ComponentId),
);
) where
Self: Sized;

/// Gets this [`Bundle`]'s component ids. This will be [`None`] if the component has not been registered.
fn get_component_ids(components: &Components, ids: &mut impl FnMut(Option<ComponentId>));
fn get_component_ids(components: &Components, ids: &mut impl FnMut(Option<ComponentId>))
where
Self: Sized;

/// Calls `func`, which should return data for each component in the bundle, in the order of
/// this bundle's [`Component`]s
Expand All @@ -185,7 +188,9 @@ pub trait DynamicBundle {
/// Calls `func` on each value, in the order of this bundle's [`Component`]s. This passes
/// ownership of the component values to `func`.
#[doc(hidden)]
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>));
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
where
Self: Sized;
}

// SAFETY:
Expand Down