-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
ReadOnlyFetch is not implimented for With<T> #2665
Comments
Oh, PEBKAC (problem exists between keyboard and chair) This is what the query filter API was for...
I should have put a comma there - the With<> goes in the filter section. Some way to make this more obvious to other users? More docs in the With<> class with examples? Discuss use of filters more explictly? |
We actually probably should implement ReadOnlyFetch for With (and all of the other filters). Filters are just normal Fetch impls that return a boolean (and there are probably legitimate reasons to query for the actual boolean results of With). If you called iter_mut(), your old code should work (although it would return In terms of docs, the Bevy Book covers this. But the "rust api docs" could definitely use more examples for cases like this. As an aside, you can simplify |
Hmm. I worry that this decreases the value of compiler errors in order to support a niche use case. Generally speaking, I would just use That said, this would be much more useful for |
My PR #2305 adds |
Hmm yeah "archetype filters" like |
Closed with the merging of #2305. |
Bevy version
bevy_ecs 0.5.0
Operating system & version
Windows 10, GCC
What you did
What you expected to happen
All queries which involve states (With, Without, Changed) should be read-only.
What actually happened
Did not compile
--> sg_simulation\src\network\sync\test_sector.rs:704:37
|
704 | for entity in query.iter() {
| ^^^^ the trait
ReadOnlyFetch
is not implemented forWithFetch<&ship_component::SpaceShip>
|
= note: required because of the requirements on the impl of
ReadOnlyFetch
for(EntityFetch, WithFetch<&ship_component::SpaceShip>)
Additional information
Non-critical, I can use
iter_mut
. With #2305 I would not have noticed this issue at all.Is perhaps similar to #763
Does this bug mean that I can't run two queries using
With<SpaceShip>
at the same time?The text was updated successfully, but these errors were encountered: