-
-
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
Clone and IntoIter support for queries #1631
Comments
Two more interesting use cases:
|
Followup conversation with @cart and @TheRawMeatball on this topic. Conclusions:
|
I'm a relative rust noob, but will this require Generic Associated Types? AFAICT you want a signature like this:
That leaves w and s unconstrained. |
Related to #2042, which would provide building blocks for iter_tools-like functionality. |
Closing in favor of directly implementing these methods as use cases come up: the |
Is the |
No, this should be quite simple to add and probably reasonably useful. If you'd like it, feel free to make a simple PR for it :) |
It'd only be valid if the query in question is read only. |
Gotcha! I’ll definitely PR it if I find a usecase where I need Cartesian product where one of the two sides is immutable, since Itertools Cartesian product requires only one of the two iterators to be
This is in regards to acquiring a |
yes, read only as in an immutable query. |
What problem does this solve or what need does it fill?
Itertools has a great number of fantastic, ergonomic ways to work with iterators, like cartesian product, combinations etc that would be regularly used in games. I would love to be able to use this with my queries, but I can't due to lacking trait impls.
What solution would you like?
impl Clone, IntoIter and any other necessary traits on both Query and QueryIter.
What alternative(s) have you considered?
Write replacements for these methods by hand, either in the engine itself or in each game's code.
Additional context
One of the features of itertools (
exactly_one
) was reinvented in #1263 already.Here's a nice code snippet that I would like to be able to compile showing the building block methods:
The text was updated successfully, but these errors were encountered: