@@ -38,10 +38,10 @@ impl<C: Component> DynamicUniformIndex<C> {
3838///
3939/// The Out type is defined in [`SyncComponent`].
4040///
41- /// The marker type is only used as a way to bypass the orphan rules. To
41+ /// The marker type `F` is only used as a way to bypass the orphan rules. To
4242/// implement the trait for a foreign type you can use a local type as the
4343/// marker, e.g. the type of the plugin that calls [`ExtractComponentPlugin`].
44- pub trait ExtractComponent < Marker = ( ) > : SyncComponent {
44+ pub trait ExtractComponent < F = ( ) > : SyncComponent < F > {
4545 /// ECS [`ReadOnlyQueryData`] to fetch the components to extract.
4646 type QueryData : ReadOnlyQueryData ;
4747 /// Filters the entities with additional constraints.
@@ -151,6 +151,10 @@ fn prepare_uniform_components<C>(
151151///
152152/// It also registers [`SyncComponentPlugin`] to ensure the extracted components
153153/// are deleted if the main world components are removed.
154+ ///
155+ /// The marker type `F` is only used as a way to bypass the orphan rules. To
156+ /// implement the trait for a foreign type you can use a local type as the
157+ /// marker, e.g. the type of the plugin that calls [`ExtractComponentPlugin`].
154158pub struct ExtractComponentPlugin < C , F = ( ) > {
155159 only_extract_visible : bool ,
156160 marker : PhantomData < fn ( ) -> ( C , F ) > ,
@@ -174,22 +178,22 @@ impl<C, F> ExtractComponentPlugin<C, F> {
174178 }
175179}
176180
177- impl < C : ExtractComponent < Marker > , Marker : ' static > Plugin for ExtractComponentPlugin < C , Marker > {
181+ impl < C : ExtractComponent < F > , F : ' static + Send + Sync > Plugin for ExtractComponentPlugin < C , F > {
178182 fn build ( & self , app : & mut App ) {
179- app. add_plugins ( SyncComponentPlugin :: < C > :: default ( ) ) ;
183+ app. add_plugins ( SyncComponentPlugin :: < C , F > :: default ( ) ) ;
180184
181185 if let Some ( render_app) = app. get_sub_app_mut ( RenderApp ) {
182186 if self . only_extract_visible {
183- render_app. add_systems ( ExtractSchedule , extract_visible_components :: < C , Marker > ) ;
187+ render_app. add_systems ( ExtractSchedule , extract_visible_components :: < C , F > ) ;
184188 } else {
185- render_app. add_systems ( ExtractSchedule , extract_components :: < C , Marker > ) ;
189+ render_app. add_systems ( ExtractSchedule , extract_components :: < C , F > ) ;
186190 }
187191 }
188192 }
189193}
190194
191195/// This system extracts all components of the corresponding [`ExtractComponent`], for entities that are synced via [`crate::sync_world::SyncToRenderWorld`].
192- fn extract_components < C : ExtractComponent < Marker > , Marker > (
196+ fn extract_components < C : ExtractComponent < F > , F > (
193197 mut commands : Commands ,
194198 mut previous_len : Local < usize > ,
195199 query : Extract < Query < ( RenderEntity , C :: QueryData ) , C :: QueryFilter > > ,
@@ -207,7 +211,7 @@ fn extract_components<C: ExtractComponent<Marker>, Marker>(
207211}
208212
209213/// This system extracts all components of the corresponding [`ExtractComponent`], for entities that are visible and synced via [`crate::sync_world::SyncToRenderWorld`].
210- fn extract_visible_components < C : ExtractComponent < Marker > , Marker > (
214+ fn extract_visible_components < C : ExtractComponent < F > , F > (
211215 mut commands : Commands ,
212216 mut previous_len : Local < usize > ,
213217 query : Extract < Query < ( RenderEntity , & ViewVisibility , C :: QueryData ) , C :: QueryFilter > > ,
0 commit comments