Skip to content
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

Allow traits to be filtered by Added/Changed #28

Closed
wants to merge 8 commits into from

Conversation

bzm3r
Copy link
Contributor

@bzm3r bzm3r commented Dec 9, 2022

ImplementsAdded/Changed functionality for bevy-trait-query!

Closes: #23

What is needed to for this to go out of draft status:

  • add change detection tests

  • update documentation to show how change detection should be used

@bzm3r bzm3r marked this pull request as draft December 9, 2022 23:04
Copy link
Owner

@JoJoJet JoJoJet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far.

src/lib.rs Outdated Show resolved Hide resolved
pub struct ChangeDetectionFetch<'w, Trait: ?Sized + TraitQuery> {
registry: &'w TraitImplRegistry<Trait>,
table_ticks: Vec<ThinSlicePtr<'w, UnsafeCell<ComponentTicks>>>,
sparse_components: Vec<&'w ComponentSparseSet>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like allocating here. Pending benchmarks, its probably faster to just iterate over the registered components and look them up in fetch, rather than caching it on the heap. The All iterators work this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoJoJet sounds good!

@bzm3r bzm3r closed this Dec 10, 2022
@bzm3r bzm3r deleted the added-changed branch December 10, 2022 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for change detection filters Changed<>, Added<>, etc
2 participants