From fac47d22e7f81b13c65e6572409a6c34d5f02eed Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Fri, 23 Aug 2024 14:09:31 +0200 Subject: [PATCH] remove LoggableBatch::num_instances --- crates/store/re_types_core/src/archetype.rs | 14 +---- .../store/re_types_core/src/loggable_batch.rs | 58 ------------------- 2 files changed, 2 insertions(+), 70 deletions(-) diff --git a/crates/store/re_types_core/src/archetype.rs b/crates/store/re_types_core/src/archetype.rs index c5e9fb0b3ad4..5f6a755ce4e3 100644 --- a/crates/store/re_types_core/src/archetype.rs +++ b/crates/store/re_types_core/src/archetype.rs @@ -213,15 +213,10 @@ impl crate::LoggableBatch for GenericIndicatorComponent { .into() } - #[inline] - fn num_instances(&self) -> usize { - 1 - } - #[inline] fn to_arrow(&self) -> SerializationResult> { let datatype = arrow2::datatypes::DataType::Null; - Ok(arrow2::array::NullArray::new(datatype, self.num_instances()).boxed()) + Ok(arrow2::array::NullArray::new(datatype, 1).boxed()) } } @@ -255,15 +250,10 @@ impl crate::LoggableBatch for NamedIndicatorComponent { self.0 } - #[inline] - fn num_instances(&self) -> usize { - 1 - } - #[inline] fn to_arrow(&self) -> SerializationResult> { let datatype = arrow2::datatypes::DataType::Null; - Ok(arrow2::array::NullArray::new(datatype, self.num_instances()).boxed()) + Ok(arrow2::array::NullArray::new(datatype, 1).boxed()) } } diff --git a/crates/store/re_types_core/src/loggable_batch.rs b/crates/store/re_types_core/src/loggable_batch.rs index 4e55d67fac50..802dbbf4e4a6 100644 --- a/crates/store/re_types_core/src/loggable_batch.rs +++ b/crates/store/re_types_core/src/loggable_batch.rs @@ -24,9 +24,6 @@ pub trait LoggableBatch { /// The fully-qualified name of this batch, e.g. `rerun.datatypes.Vec2D`. fn name(&self) -> Self::Name; - /// The number of component instances stored into this batch. - fn num_instances(&self) -> usize; - /// Serializes the batch into an Arrow array. fn to_arrow(&self) -> SerializationResult>; } @@ -90,11 +87,6 @@ impl<'a> LoggableBatch for MaybeOwnedComponentBatch<'a> { self.as_ref().name() } - #[inline] - fn num_instances(&self) -> usize { - self.as_ref().num_instances() - } - #[inline] fn to_arrow(&self) -> SerializationResult> { self.as_ref().to_arrow() @@ -113,11 +105,6 @@ impl LoggableBatch for L { L::name() } - #[inline] - fn num_instances(&self) -> usize { - 1 - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow([std::borrow::Cow::Borrowed(self)]) @@ -136,11 +123,6 @@ impl LoggableBatch for Option { L::name() } - #[inline] - fn num_instances(&self) -> usize { - self.is_some() as usize - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v))) @@ -159,11 +141,6 @@ impl LoggableBatch for Vec { L::name() } - #[inline] - fn num_instances(&self) -> usize { - self.len() - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v))) @@ -182,11 +159,6 @@ impl LoggableBatch for Vec> { L::name() } - #[inline] - fn num_instances(&self) -> usize { - self.len() - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow_opt( @@ -208,11 +180,6 @@ impl LoggableBatch for [L; N] { L::name() } - #[inline] - fn num_instances(&self) -> usize { - N - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v))) @@ -231,11 +198,6 @@ impl LoggableBatch for [Option; N] { L::name() } - #[inline] - fn num_instances(&self) -> usize { - N - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow_opt( @@ -257,11 +219,6 @@ impl<'a, L: Loggable> LoggableBatch for &'a [L] { L::name() } - #[inline] - fn num_instances(&self) -> usize { - self.len() - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v))) @@ -280,11 +237,6 @@ impl<'a, L: Loggable> LoggableBatch for &'a [Option] { L::name() } - #[inline] - fn num_instances(&self) -> usize { - self.len() - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow_opt( @@ -306,11 +258,6 @@ impl<'a, L: Loggable, const N: usize> LoggableBatch for &'a [L; N] { L::name() } - #[inline] - fn num_instances(&self) -> usize { - N - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v))) @@ -329,11 +276,6 @@ impl<'a, L: Loggable, const N: usize> LoggableBatch for &'a [Option; N] { L::name() } - #[inline] - fn num_instances(&self) -> usize { - N - } - #[inline] fn to_arrow(&self) -> SerializationResult> { L::to_arrow_opt(