-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
add Iterable traits #397
Comments
I believe this was basically done with |
That's untrue. |
@Lucretiel an implementation of |
It's trickier than that since you must use |
In this vein, another powerful option would be adding
|
If that's the idiom for "iterate over references", it might be worth adding implementations of impl<'a, I> IntoIterator for &'a iter::Take<I>
where for <'b> &'b I: IntoIterator { ... } This came up for me today because I'm trying to find the best way to express "Iterate over an |
We already have such impls for the basic collection iterators, but you cannot constrain You cannot do iterator adapters like that regardless because they consume the iterator by value. I think wrapper types should work now, albeit with boiler plate. I do not know any clean long term solution except expanding closures via roughly the |
Issue by thestinger
Friday Jul 05, 2013 at 02:59 GMT
For earlier discussion, see rust-lang/rust#7597
This issue was labelled with: A-libs, A-traits, I-enhancement in the Rust repository
Something like the following:
In the future we can define default methods like
enumerate
when method resolve is fixed. #5898The text was updated successfully, but these errors were encountered: