From 5d474c482c93514e01b9aef046bf14144580692c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Jun 2023 13:07:43 +0200 Subject: [PATCH] Replace `UpdateSolid::add_shell` with `add_shells` This is more flexible and follows the convention of other, similar methods of the operations API. --- crates/fj-core/src/operations/build/solid.rs | 2 +- crates/fj-core/src/operations/update/solid.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/operations/build/solid.rs b/crates/fj-core/src/operations/build/solid.rs index 080405ee5..a37b52267 100644 --- a/crates/fj-core/src/operations/build/solid.rs +++ b/crates/fj-core/src/operations/build/solid.rs @@ -24,7 +24,7 @@ pub trait BuildSolid { services: &mut Services, ) -> Tetrahedron { let shell = Shell::tetrahedron(points, services).insert(services); - let solid = Solid::empty().add_shell(shell.shell.clone()); + let solid = Solid::empty().add_shells([shell.shell.clone()]); Tetrahedron { solid, shell } } diff --git a/crates/fj-core/src/operations/update/solid.rs b/crates/fj-core/src/operations/update/solid.rs index 9c0e340f7..a6135207e 100644 --- a/crates/fj-core/src/operations/update/solid.rs +++ b/crates/fj-core/src/operations/update/solid.rs @@ -6,12 +6,18 @@ use crate::{ /// Update a [`Solid`] pub trait UpdateSolid { /// Add a shell to the solid - fn add_shell(&self, shell: Handle) -> Solid; + fn add_shells( + &self, + shells: impl IntoIterator>, + ) -> Solid; } impl UpdateSolid for Solid { - fn add_shell(&self, shell: Handle) -> Solid { - let shells = self.shells().cloned().chain([shell]); + fn add_shells( + &self, + shells: impl IntoIterator>, + ) -> Solid { + let shells = self.shells().cloned().chain(shells); Solid::new(shells) } }