Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
LinesIter
algorithm to iterate over lines in a geometry #757Add
LinesIter
algorithm to iterate over lines in a geometry #757Changes from 12 commits
e74d6ce
77af02d
e407ab0
15547da
62418ba
5797f46
807aca6
c4a5a68
e3f1680
2fb1314
cdf0b22
59e8403
0b20e6d
d9510be
460bb5c
3605cb8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 am new(ish) to Rust, and I spent some time trying to wrap my head around this.
My current understanding is that as long as RFC-2071 is unstable, crate APIs should likely not use the
impl Trait
feature (in the return position, for existential types). Two reasons that I think I'd avoid this feature:#[derive(Debug)]
and friends) don't work well). In our case,impl Iterator<Item=Line<T>
is notDebug
even if bothT
andLine
are).Basing my understanding so far mostly off of https://www.reddit.com/r/rust/comments/8ik620/notes_on_impl_trait/ and https://users.rust-lang.org/t/embedding-trait-inside-of-struct/37176/14
In this case, I was stuck because of the first issue -- I needed to name the type for
LinesIter::Iter
, but had no way to do it.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.
Did I say I'm new to Rust? Please let me know if I'm understanding this wrong / I'm missing something obvious in how
impl Trait
works.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.
Note to self: Update #681 in some form if
impl Trait
should be reconsidered in the public API ofgeo-types
.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 would actually like to introduce newtypes for all these concrete
LinesIter::Iter
types because they currently leak implementation details (about how iterators are chained etc).I followed the pattern in
CoordsIter
for this PR, but if there is agreement, I'm happy to introduce newtypes for bothCoordsIter
andLinesIter
.