-
-
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] - Add IntoIterator impls for &Query and &mut Query #4692
Conversation
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.
Could you add a pair of tests to make sure the desired pattern continues to compile?
|
||
impl<'w, Q: WorldQuery, F: WorldQuery> IntoIterator for &'w mut Query<'_, '_, Q, F> { | ||
type Item = QueryItem<'w, Q>; | ||
type IntoIter = QueryIter<'w, 'w, Q, QueryFetch<'w, Q>, F>; |
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.
why is this not QueryIter<'w, 's, ...
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.
I copied the bounds off of iter_mut, since iter_mut bound both 'w and 's to the borrow lifetime i did the same for this impl.
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.
alright i guess thats fine then
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.
Test LGTM and I think this functionality is good; only outstanding question is the lifetimes. I agree it's a bit suspicious.
bors r+ |
# Objective These types of IntoIterator impls are a common pattern in Rust, and these implementations make this common pattern work for bevy queries.
Build failed (retrying...): |
# Objective These types of IntoIterator impls are a common pattern in Rust, and these implementations make this common pattern work for bevy queries.
# Objective These types of IntoIterator impls are a common pattern in Rust, and these implementations make this common pattern work for bevy queries.
# Objective These types of IntoIterator impls are a common pattern in Rust, and these implementations make this common pattern work for bevy queries.
# Objective These types of IntoIterator impls are a common pattern in Rust, and these implementations make this common pattern work for bevy queries.
Objective
These types of IntoIterator impls are a common pattern in Rust, and these implementations make this common pattern work for bevy queries.