diff --git a/crates/fj-core/src/algorithms/approx/curve/approx.rs b/crates/fj-core/src/algorithms/approx/curve/approx.rs index b0ee82d3f..00f5d25b6 100644 --- a/crates/fj-core/src/algorithms/approx/curve/approx.rs +++ b/crates/fj-core/src/algorithms/approx/curve/approx.rs @@ -50,12 +50,10 @@ impl CurveApprox { impl 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(), } } } diff --git a/crates/fj-core/src/geometry/boundary/multiple.rs b/crates/fj-core/src/geometry/boundary/multiple.rs index b4516e3b7..466059b8a 100644 --- a/crates/fj-core/src/geometry/boundary/multiple.rs +++ b/crates/fj-core/src/geometry/boundary/multiple.rs @@ -10,8 +10,7 @@ use crate::geometry::CurveBoundary; /// boundary. #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct CurveBoundaries { - /// The [`CurveBoundary`] instances - pub inner: Vec<(CurveBoundary>, T)>, + inner: Vec<(CurveBoundary>, T)>, } impl CurveBoundaries { @@ -29,7 +28,7 @@ impl CurveBoundaries { // the removed element's boundary matches the boundary provided // to us. // - // This is what the caller was asking for. Return it! + // This is what the caller is asking for. Return it! Some(payload) } _ => { @@ -115,6 +114,19 @@ impl Default for CurveBoundaries { } } +impl FromIterator<(CurveBoundary>, T)> + for CurveBoundaries +{ + fn from_iter(iter: I) -> Self + where + I: IntoIterator>, 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