Skip to main content

ExtractComponent

Trait ExtractComponent 

Source
pub trait ExtractComponent<L, F = ()>: SyncComponent<L, F>
where L: AppLabel,
{ type QueryData: ReadOnlyQueryData; type QueryFilter: QueryFilter; type Out: Bundle where <Self::Out as DynamicBundle>::Effect: NoBundleEffect; // Required method fn extract_component( item: <Self::QueryData as QueryData>::Item<'_, '_>, ) -> Option<Self::Out>; }
Expand description

Describes how a component gets extracted from the main app to a sub app.

Therefore the component is transferred from the “app world” into the “sub world” in the ExtractSchedule step. This functionality is enabled by adding ExtractComponentPlugin with the component type.

The Out type is defined in SyncComponent.

The marker type F is only used as a way to bypass the orphan rules. To implement the trait for a foreign type you can use a local type as the marker, e.g. the type of the plugin that calls ExtractComponentPlugin.

Required Associated Types§

Source

type QueryData: ReadOnlyQueryData

ECS ReadOnlyQueryData to fetch the components to extract.

Source

type QueryFilter: QueryFilter

Filters the entities with additional constraints.

Source

type Out: Bundle where <Self::Out as DynamicBundle>::Effect: NoBundleEffect

The output from extraction, i.e. ExtractComponent::extract_component.

The output components won’t be removed automatically from the sub world if the implementing component is removed, unless you set them in the SyncComponent::Target.

Required Methods§

Source

fn extract_component( item: <Self::QueryData as QueryData>::Item<'_, '_>, ) -> Option<Self::Out>

Defines how the component is transferred into the “sub world”.

Returning None based on the queried item will remove the SyncComponent::Target from the entity in the sub 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.

Implementors§

Source§

impl ExtractComponent<RenderApp> for DebandDither

Source§

impl ExtractComponent<RenderApp> for Tonemapping

Source§

impl ExtractComponent<RenderApp> for Msaa
where Msaa: Clone,

Source§

impl ExtractComponent<RenderApp> for Readback
where Readback: Clone,

Source§

impl ExtractComponent<RenderApp> for CameraMainTextureUsages

Source§

impl ExtractComponent<RenderApp> for OrderIndependentTransparencySettings

Source§

impl ExtractComponent<RenderApp> for NoBackgroundMotionVectors

Source§

impl ExtractComponent<RenderApp> for PbrDeferredLightingDepthId

Source§

impl ExtractComponent<RenderApp> for ContactShadows

Source§

impl ExtractComponent<RenderApp> for ScreenSpaceAmbientOcclusion

Source§

impl ExtractComponent<RenderApp> for ScreenSpaceReflections

Source§

impl ExtractComponent<RenderApp> for ScreenSpaceTransmission

Source§

impl ExtractComponent<RenderApp> for AutoExposure

Source§

impl ExtractComponent<RenderApp> for Bloom

Source§

type QueryData = (&'static Bloom, &'static Camera)

Source§

type QueryFilter = With<Hdr>

Source§

type Out = (Bloom, BloomUniforms)

Source§

impl ExtractComponent<RenderApp> for ChromaticAberration

Source§

impl ExtractComponent<RenderApp> for LensDistortion

Source§

impl ExtractComponent<RenderApp> for Vignette

Source§

impl ExtractComponent<RenderApp> for MotionBlur

Source§

type QueryData = &'static MotionBlur

Source§

type QueryFilter = With<Camera>

Source§

type Out = MotionBlurUniform

Source§

impl ExtractComponent<RenderApp> for Camera2d

Source§

impl ExtractComponent<RenderApp> for Camera3d

Source§

impl ExtractComponent<RenderApp> for DistanceFog

Source§

impl ExtractComponent<RenderApp> for OcclusionCulling