Skip to content

Commit

Permalink
Construct MultiPolygon from Vec of things that is Into<Polygon>
Browse files Browse the repository at this point in the history
  • Loading branch information
Rory McCann committed Feb 13, 2019
1 parent 96c7846 commit f0d799b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions geo-types/src/multi_polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ impl<T: CoordinateType, IP: Into<Polygon<T>>> From<IP> for MultiPolygon<T> {
}
}

impl<T: CoordinateType, IP: Into<Polygon<T>>> From<Vec<IP>> for MultiPolygon<T> {
fn from(x: Vec<IP>) -> Self {
MultiPolygon(x.into_iter().map(|p| p.into()).collect())
}
}


impl<T: CoordinateType, IP: Into<Polygon<T>>> FromIterator<IP> for MultiPolygon<T> {
fn from_iter<I: IntoIterator<Item = IP>>(iter: I) -> Self {
MultiPolygon(iter.into_iter().map(|p| p.into()).collect())
Expand Down

0 comments on commit f0d799b

Please sign in to comment.