(geometry: Geometry)
| 12 | } |
| 13 | |
| 14 | fn implicitly_open(geometry: Geometry) -> Box<dyn Iterator<Item = Coord>> { |
| 15 | match geometry { |
| 16 | Geometry::Point(_) | Geometry::Line(_) | Geometry::Rect(_) | Geometry::Triangle(_) => { |
| 17 | // This collect _is_ actually needed :( |
| 18 | // |
| 19 | // .coords_iter() doesn't consume the geometry, but the function signature for |
| 20 | // implicitly_open() requires that we do, so that's what we'll do then. |
| 21 | #[allow(clippy::needless_collect)] |
| 22 | let coords: Vec<_> = geometry.coords_iter().collect(); |
| 23 | Box::new(coords.into_iter()) |
| 24 | } |
| 25 | Geometry::LineString(ls) => Box::new(implicitly_open_linestring(ls)), |
| 26 | Geometry::Polygon(p) => { |
| 27 | let (exterior, interiors) = p.into_inner(); |
| 28 | |
| 29 | let exterior = implicitly_open_linestring(exterior); |
| 30 | let interiors = interiors.into_iter().flat_map(implicitly_open_linestring); |
| 31 | let all_points = exterior.chain(interiors); |
| 32 | Box::new(all_points) |
| 33 | } |
| 34 | _ => unreachable!("MULTI-geometries are flattened in the caller of this function"), |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | fn implicitly_open_ref(geometry: &Geometry) -> Box<dyn Iterator<Item = Coord> + '_> { |
| 39 | match geometry { |
nothing calls this directly
no test coverage detected