Skip to content

Commit

Permalink
Merge #404
Browse files Browse the repository at this point in the history
404: Add a mutable Coordinate iterator to LineString r=frewsxcv a=urschrei



Co-authored-by: Stephan Hügel <urschrei@gmail.com>
  • Loading branch information
bors[bot] and urschrei committed Dec 22, 2019
2 parents dbb07df + 7831ed0 commit 14e9376
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions geo-types/src/line_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ impl<T: CoordinateType> IntoIterator for LineString<T> {
}
}

/// Mutably iterate over all the [Coordinate](struct.Coordinates.html)s in this `LineString`.
impl<'a, T: CoordinateType> IntoIterator for &'a mut LineString<T> {
type Item = &'a mut Coordinate<T>;
type IntoIter = ::std::slice::IterMut<'a, Coordinate<T>>;

fn into_iter(self) -> ::std::slice::IterMut<'a, Coordinate<T>> {
self.0.iter_mut()
}
}

impl<T: CoordinateType> Index<usize> for LineString<T> {
type Output = Coordinate<T>;

Expand Down

0 comments on commit 14e9376

Please sign in to comment.