Skip to content

Commit

Permalink
remove LoggableBatch::num_instances
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Aug 23, 2024
1 parent e9de566 commit fac47d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 70 deletions.
14 changes: 2 additions & 12 deletions crates/store/re_types_core/src/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,10 @@ impl<A: Archetype> crate::LoggableBatch for GenericIndicatorComponent<A> {
.into()
}

#[inline]
fn num_instances(&self) -> usize {
1
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn arrow2::array::Array>> {
let datatype = arrow2::datatypes::DataType::Null;
Ok(arrow2::array::NullArray::new(datatype, self.num_instances()).boxed())
Ok(arrow2::array::NullArray::new(datatype, 1).boxed())
}
}

Expand Down Expand Up @@ -255,15 +250,10 @@ impl crate::LoggableBatch for NamedIndicatorComponent {
self.0
}

#[inline]
fn num_instances(&self) -> usize {
1
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn arrow2::array::Array>> {
let datatype = arrow2::datatypes::DataType::Null;
Ok(arrow2::array::NullArray::new(datatype, self.num_instances()).boxed())
Ok(arrow2::array::NullArray::new(datatype, 1).boxed())
}
}

Expand Down
58 changes: 0 additions & 58 deletions crates/store/re_types_core/src/loggable_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Box<dyn ::arrow2::array::Array>>;
}
Expand Down Expand Up @@ -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<Box<dyn ::arrow2::array::Array>> {
self.as_ref().to_arrow()
Expand All @@ -113,11 +105,6 @@ impl<L: Clone + Loggable> LoggableBatch for L {
L::name()
}

#[inline]
fn num_instances(&self) -> usize {
1
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn ::arrow2::array::Array>> {
L::to_arrow([std::borrow::Cow::Borrowed(self)])
Expand All @@ -136,11 +123,6 @@ impl<L: Clone + Loggable> LoggableBatch for Option<L> {
L::name()
}

#[inline]
fn num_instances(&self) -> usize {
self.is_some() as usize
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn ::arrow2::array::Array>> {
L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v)))
Expand All @@ -159,11 +141,6 @@ impl<L: Clone + Loggable> LoggableBatch for Vec<L> {
L::name()
}

#[inline]
fn num_instances(&self) -> usize {
self.len()
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn ::arrow2::array::Array>> {
L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v)))
Expand All @@ -182,11 +159,6 @@ impl<L: Loggable> LoggableBatch for Vec<Option<L>> {
L::name()
}

#[inline]
fn num_instances(&self) -> usize {
self.len()
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn ::arrow2::array::Array>> {
L::to_arrow_opt(
Expand All @@ -208,11 +180,6 @@ impl<L: Loggable, const N: usize> LoggableBatch for [L; N] {
L::name()
}

#[inline]
fn num_instances(&self) -> usize {
N
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn ::arrow2::array::Array>> {
L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v)))
Expand All @@ -231,11 +198,6 @@ impl<L: Loggable, const N: usize> LoggableBatch for [Option<L>; N] {
L::name()
}

#[inline]
fn num_instances(&self) -> usize {
N
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn ::arrow2::array::Array>> {
L::to_arrow_opt(
Expand All @@ -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<Box<dyn ::arrow2::array::Array>> {
L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v)))
Expand All @@ -280,11 +237,6 @@ impl<'a, L: Loggable> LoggableBatch for &'a [Option<L>] {
L::name()
}

#[inline]
fn num_instances(&self) -> usize {
self.len()
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn ::arrow2::array::Array>> {
L::to_arrow_opt(
Expand All @@ -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<Box<dyn ::arrow2::array::Array>> {
L::to_arrow(self.iter().map(|v| std::borrow::Cow::Borrowed(v)))
Expand All @@ -329,11 +276,6 @@ impl<'a, L: Loggable, const N: usize> LoggableBatch for &'a [Option<L>; N] {
L::name()
}

#[inline]
fn num_instances(&self) -> usize {
N
}

#[inline]
fn to_arrow(&self) -> SerializationResult<Box<dyn ::arrow2::array::Array>> {
L::to_arrow_opt(
Expand Down

0 comments on commit fac47d2

Please sign in to comment.