diff --git a/crates/fj-kernel/src/builder/mod.rs b/crates/fj-kernel/src/builder/mod.rs index 234684ead..9fd19b034 100644 --- a/crates/fj-kernel/src/builder/mod.rs +++ b/crates/fj-kernel/src/builder/mod.rs @@ -47,6 +47,9 @@ pub trait ObjectArgument: IntoIterator { /// A return value that has one more element thatn the argument type SizePlusOne; + /// Return the number of objects + fn num_objects(&self) -> usize; + /// Create a return value by mapping the implementing type fn map(self, f: F) -> Self::SameSize where @@ -62,6 +65,10 @@ impl ObjectArgument for Vec { type SameSize = Vec; type SizePlusOne = Vec; + fn num_objects(&self) -> usize { + self.len() + } + fn map(self, mut f: F) -> Self::SameSize where F: FnMut(T) -> R, @@ -96,6 +103,10 @@ macro_rules! impl_object_argument_for_arrays { type SameSize = [R; $len]; type SizePlusOne = [R; $len_plus_one]; + fn num_objects(&self) -> usize { + self.len() + } + fn map(self, f: F) -> Self::SameSize where F: FnMut(T) -> R,