Skip to content

Commit

Permalink
Merge georust#342
Browse files Browse the repository at this point in the history
342: Construct MultiPolygon from Vec of things that is Into<Polygon> r=frewsxcv a=rory



Co-authored-by: Rory McCann <rory@technomancy.org>
  • Loading branch information
bors[bot] and Rory McCann committed Feb 16, 2019
2 parents 925fe24 + f0d799b commit f4ed057
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 f4ed057

Please sign in to comment.