galileo_types/impls/
multi_contour.rs

1use serde::{Deserialize, Serialize};
2
3use crate::geometry_type::{GeometryType, MultiContourGeometryType};
4use crate::impls::contour::Contour;
5
6/// A set of contours.
7#[derive(Debug, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize)]
8pub struct MultiContour<P>(Vec<Contour<P>>);
9
10impl<P: Copy> crate::multi_contour::MultiContour for MultiContour<P> {
11    type Contour = Contour<P>;
12
13    fn contours(&self) -> impl Iterator<Item = &Self::Contour> {
14        self.0.iter()
15    }
16}
17
18impl<P> From<Vec<Contour<P>>> for MultiContour<P> {
19    fn from(value: Vec<Contour<P>>) -> Self {
20        Self(value)
21    }
22}
23
24impl<P: GeometryType> GeometryType for MultiContour<P> {
25    type Type = MultiContourGeometryType;
26    type Space = P::Space;
27}