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

Query using the Or operator do not provide .iter() method, only iter_mut(). #762

Closed
BorisBoutillier opened this issue Nov 1, 2020 · 0 comments · Fixed by #763
Closed
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior

Comments

@BorisBoutillier
Copy link
Contributor

Bevy version
Following version, containing changes on query:
9cc6368

Operating system & version
Ubuntu 20.04

What you did
The following query, that contains an Or, does not have the .iter() method, only iter_mut()

mut query_changed_camera: Query<(
        &Camera,
        Or<(Changed<OrthographicProjection>, Changed<Transform>)>,
    )>,
for (camera, (camera_ortho, camera_transform)) in query_changed_camera.iter() {

What you expected to happen
Should have compiled

What actually happened
Compilation failed:

error[E0277]: the trait bound `bevy_hecs::query::FetchOr<(bevy_hecs::query::FetchChanged<bevy::render::camera::OrthographicProjection>, bevy_hecs::query::FetchChanged<bevy::prelude::Transform>)>: bevy::ecs::ReadOnlyFetch` is not satisfied
  --> src/cursor_2dworld_pos_plugin.rs:62:76
   |
62 |     for (camera, (camera_ortho, camera_transform)) in query_changed_camera.iter() {
   |                                                                            ^^^^ the trait `bevy::ecs::ReadOnlyFetch` is not implemented for `bevy_hecs::query::FetchOr<(bevy_hecs::query::FetchChanged<bevy::render::camera::OrthographicProjection>, bevy_hecs::query::FetchChanged<bevy::prelude::Transform>)>`
   |
   = note: required because of the requirements on the impl of `bevy::ecs::ReadOnlyFetch` for `(bevy_hecs::query::FetchRead<bevy::render::camera::Camera>, bevy_hecs::query::FetchOr<(bevy_hecs::query::FetchChanged<bevy::render::camera::OrthographicProjection>, bevy_hecs::query::FetchChanged<bevy::prelude::Transform>)>)`

Additional information

Using the .iter_mut() method works, so, nothing critical here.

As discussed in the discord, the culprit is the 'Or' , not the Changed.

it can be the same issue as #753 , but we were not sure on discord, so filing another issue.

@BorisBoutillier BorisBoutillier added the C-Bug An unexpected or incorrect behavior label Nov 1, 2020
@karroffel karroffel added the A-ECS Entities, components, systems, and events label Nov 1, 2020
@cart cart closed this as completed in #763 Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants