Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/release-content/migration-guides/extract_refactor.md
9333 views
---
title: "`ExtractComponent` refactor" pull_requests: [22766]
---

The Out type from ExtractComponent has been split into a separate SyncComponent trait.

Both traits have also gotten an optional marker type that can be used to bypass orphan rules, see the docs for details.

impl ExtractComponent for MyComponent { type QueryData = (); type QueryFilter = (); type Out = Self; fn extract_component( item: QueryItem<'_, '_, Self::QueryData>, ) -> Option<Self::Out> { Some(*item) } }

After:

impl SyncComponent for MyComponent { type Out = Self; } impl ExtractComponent for MyComponent { type QueryData = (); type QueryFilter = (); fn extract_component( item: QueryItem<'_, '_, Self::QueryData>, ) -> Option<Self::Out> { Some(*item) } }