mirror of
https://github.com/hannobraun/Fornjot
synced 2025-10-14 11:58:20 +00:00
Implement FromIterator
for CurveBoundaries
This commit is contained in:
parent
70e9587c95
commit
90657b2452
@ -50,12 +50,10 @@ impl CurveApprox {
|
||||
impl<const N: usize> From<[CurveApproxSegment; N]> for CurveApprox {
|
||||
fn from(segments: [CurveApproxSegment; N]) -> Self {
|
||||
Self {
|
||||
segments: CurveBoundaries {
|
||||
inner: segments
|
||||
.into_iter()
|
||||
.map(|segment| (segment.boundary, segment.points))
|
||||
.collect(),
|
||||
},
|
||||
segments: segments
|
||||
.into_iter()
|
||||
.map(|segment| (segment.boundary, segment.points))
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,6 +115,19 @@ impl<T: CurveBoundariesPayload> Default for CurveBoundaries<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: CurveBoundariesPayload> FromIterator<(CurveBoundary<Point<1>>, T)>
|
||||
for CurveBoundaries<T>
|
||||
{
|
||||
fn from_iter<I>(iter: I) -> Self
|
||||
where
|
||||
I: IntoIterator<Item = (CurveBoundary<Point<1>>, T)>,
|
||||
{
|
||||
Self {
|
||||
inner: iter.into_iter().collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A payload that can be used in [`CurveBoundaries`]
|
||||
pub trait CurveBoundariesPayload: Clone + Ord {
|
||||
/// Reverse the orientation of the payload
|
||||
|
Loading…
x
Reference in New Issue
Block a user