-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Implement Clone for Fetches #2641
Conversation
Since the access in |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! This is all safe. We could merge this as-is, but theres one place to improve flexibility (see comment).
bors r+ |
# Objective This: ```rust use bevy::prelude::*; fn main() { App::new() .add_system(test) .run(); } fn test(entities: Query<Entity>) { let mut combinations = entities.iter_combinations_mut(); while let Some([e1, e2]) = combinations.fetch_next() { dbg!(e1); } } ``` fails with the message "the trait bound `bevy::ecs::query::EntityFetch: std::clone::Clone` is not satisfied". ## Solution It works after adding the naive clone implementation to EntityFetch. I'm not super familiar with ECS internals, so I'd appreciate input on this.
Build failed: |
bors r+ |
# Objective This: ```rust use bevy::prelude::*; fn main() { App::new() .add_system(test) .run(); } fn test(entities: Query<Entity>) { let mut combinations = entities.iter_combinations_mut(); while let Some([e1, e2]) = combinations.fetch_next() { dbg!(e1); } } ``` fails with the message "the trait bound `bevy::ecs::query::EntityFetch: std::clone::Clone` is not satisfied". ## Solution It works after adding the naive clone implementation to EntityFetch. I'm not super familiar with ECS internals, so I'd appreciate input on this.
Objective
This:
fails with the message "the trait bound
bevy::ecs::query::EntityFetch: std::clone::Clone
is not satisfied".Solution
It works after adding the naive clone implementation to EntityFetch. I'm not super familiar with ECS internals, so I'd appreciate input on this.