pub trait ExtractComponent<F = ()>: SyncComponent<F> {
type QueryData: ReadOnlyQueryData;
type QueryFilter: QueryFilter;
type Out: Bundle<Effect: NoBundleEffect>;
// Required method
fn extract_component(
item: QueryItem<'_, '_, Self::QueryData>,
) -> Option<Self::Out>;
}Expand description
Describes how a component gets extracted for rendering.
Therefore the component is transferred from the “app world” into the “render world” in the Extract step. This functionality is enabled by adding ExtractComponentPlugin with the component type.
The Out type is defined in SyncComponent.
See sync for more details.
Required Associated Types§
Sourcetype QueryFilter: QueryFilter
type QueryFilter: QueryFilter
Filters the entities with additional constraints.
Sourcetype Out: Bundle<Effect: NoBundleEffect>
type Out: Bundle<Effect: NoBundleEffect>
The output from extraction, i.e. ExtractComponent::extract_component.
Required Methods§
Sourcefn extract_component(
item: QueryItem<'_, '_, Self::QueryData>,
) -> Option<Self::Out>
fn extract_component( item: QueryItem<'_, '_, Self::QueryData>, ) -> Option<Self::Out>
Defines how the component is transferred into the “render world”.
Returning None based on the queried item will remove the SyncComponent::Target from the entity in the render world.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.