-
Notifications
You must be signed in to change notification settings - Fork 7
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
Cleanup Ext + Add utility iterators #6
Conversation
/// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping. | ||
#[inline] | ||
pub fn range_step<A: Int>(start: A, stop: A, step: A) -> RangeStep<A> { | ||
RangeStep{start: start, stop: stop, step: step} |
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 prefer RangeStep { .. }
with spaces, do you have a strong preference to this?
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.
This is largely a copy-paste job from the rust-lang, this file has some legacy style. Can clean up.
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.
Ah, that makes sense.
I'll merge this with the style fixes but after actually thinking about it I realized that there's no reason to split this trait since |
Hmm, good point. Want me to merge them in this PR? |
If you're up for it. I'd prefer if all the default definitions go in the trait, but the definitions of those types and their impls go in |
Ah crap, that doesn't work because the fields are private. |
Urgh. I guess the type definitions need to go in lib, but the impls can go in |
Done |
stop: A, | ||
} | ||
|
||
impl<A:Copy> Copy for Range<A> {} |
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.
#[deriving(Copy)]
?
Just some last nitpicks and ready to go |
Done. |
Alright, ready to go! |
Cleanup Ext + Add utility iterators
Having the methods as default impls prevents repeating signatures, and future-proofs for the possibility of implementation specialization.
Also adds
range
et al as well as thecount
adaptor.