diff --git a/crates/store/re_types_core/src/lib.rs b/crates/store/re_types_core/src/lib.rs index f6deee691390..e89ee70bbc2d 100644 --- a/crates/store/re_types_core/src/lib.rs +++ b/crates/store/re_types_core/src/lib.rs @@ -109,6 +109,15 @@ impl AsComponents for [&dyn ComponentBatch; N] { } } +impl AsComponents for [Box; N] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .map(|batch| ComponentBatchCowWithDescriptor::new(&**batch)) + .collect() + } +} + impl AsComponents for &[&dyn ComponentBatch] { #[inline] fn as_component_batches(&self) -> Vec> { @@ -118,6 +127,15 @@ impl AsComponents for &[&dyn ComponentBatch] { } } +impl AsComponents for &[Box] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .map(|batch| ComponentBatchCowWithDescriptor::new(&**batch)) + .collect() + } +} + impl AsComponents for Vec<&dyn ComponentBatch> { #[inline] fn as_component_batches(&self) -> Vec> { @@ -127,6 +145,96 @@ impl AsComponents for Vec<&dyn ComponentBatch> { } } +impl AsComponents for Vec> { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .map(|batch| ComponentBatchCowWithDescriptor::new(&**batch)) + .collect() + } +} + +impl AsComponents for [AS; N] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for [&dyn AsComponents; N] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for [Box; N] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for &[AS] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for &[&dyn AsComponents] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for &[Box] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for Vec { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for Vec<&dyn AsComponents> { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for Vec> { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + // --- mod archetype; diff --git a/docs/snippets/all/archetypes/image_send_columns.rs b/docs/snippets/all/archetypes/image_send_columns.rs index 5f0e2c991f81..73ed177259fd 100644 --- a/docs/snippets/all/archetypes/image_send_columns.rs +++ b/docs/snippets/all/archetypes/image_send_columns.rs @@ -23,7 +23,13 @@ fn main() -> Result<(), Box> { // Log the ImageFormat and indicator once, as static. let format = rerun::components::ImageFormat::rgb8([width as _, height as _]); - rec.log_static("images", &[&format as _, &rerun::Image::indicator() as _])?; + rec.log_static( + "images", + &[ + &format as &dyn rerun::ComponentBatch, + &rerun::Image::indicator(), + ], + )?; // Split up the image data into several components referencing the underlying data. let image_size_in_bytes = width * height * 3; diff --git a/docs/snippets/all/archetypes/mesh3d_partial_updates.rs b/docs/snippets/all/archetypes/mesh3d_partial_updates.rs index 1027b254a0bb..791428f62e52 100644 --- a/docs/snippets/all/archetypes/mesh3d_partial_updates.rs +++ b/docs/snippets/all/archetypes/mesh3d_partial_updates.rs @@ -26,7 +26,7 @@ fn main() -> Result<(), Box> { (glam::Vec3::from(vertex_positions[1]) * factor).into(), (glam::Vec3::from(vertex_positions[2]) * factor).into(), ]; - rec.log("triangle", &[&vertex_positions as _])?; + rec.log("triangle", &vertex_positions)?; } Ok(())