#![allow(unused_imports)]
#![allow(unused_parens)]
#![allow(clippy::clone_on_copy)]
#![allow(clippy::cloned_instead_of_copied)]
#![allow(clippy::map_flatten)]
#![allow(clippy::needless_question_mark)]
#![allow(clippy::new_without_default)]
#![allow(clippy::redundant_closure)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::too_many_lines)]
use ::re_types_core::try_serialize_field;
use ::re_types_core::SerializationResult;
use ::re_types_core::{ComponentBatch, SerializedComponentBatch};
use ::re_types_core::{ComponentDescriptor, ComponentName};
use ::re_types_core::{DeserializationError, DeserializationResult};
#[derive(Clone, Debug, PartialEq, Default)]
pub struct Capsules3D {
pub lengths: Option<SerializedComponentBatch>,
pub radii: Option<SerializedComponentBatch>,
pub translations: Option<SerializedComponentBatch>,
pub rotation_axis_angles: Option<SerializedComponentBatch>,
pub quaternions: Option<SerializedComponentBatch>,
pub colors: Option<SerializedComponentBatch>,
pub labels: Option<SerializedComponentBatch>,
pub show_labels: Option<SerializedComponentBatch>,
pub class_ids: Option<SerializedComponentBatch>,
}
impl Capsules3D {
#[inline]
pub fn descriptor_lengths() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.Length".into(),
archetype_field_name: Some("lengths".into()),
}
}
#[inline]
pub fn descriptor_radii() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.Radius".into(),
archetype_field_name: Some("radii".into()),
}
}
#[inline]
pub fn descriptor_translations() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.PoseTranslation3D".into(),
archetype_field_name: Some("translations".into()),
}
}
#[inline]
pub fn descriptor_rotation_axis_angles() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.PoseRotationAxisAngle".into(),
archetype_field_name: Some("rotation_axis_angles".into()),
}
}
#[inline]
pub fn descriptor_quaternions() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.PoseRotationQuat".into(),
archetype_field_name: Some("quaternions".into()),
}
}
#[inline]
pub fn descriptor_colors() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.Color".into(),
archetype_field_name: Some("colors".into()),
}
}
#[inline]
pub fn descriptor_labels() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.Text".into(),
archetype_field_name: Some("labels".into()),
}
}
#[inline]
pub fn descriptor_show_labels() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.ShowLabels".into(),
archetype_field_name: Some("show_labels".into()),
}
}
#[inline]
pub fn descriptor_class_ids() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.ClassId".into(),
archetype_field_name: Some("class_ids".into()),
}
}
#[inline]
pub fn descriptor_indicator() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Capsules3D".into()),
component_name: "rerun.components.Capsules3DIndicator".into(),
archetype_field_name: None,
}
}
}
static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> =
once_cell::sync::Lazy::new(|| {
[
Capsules3D::descriptor_lengths(),
Capsules3D::descriptor_radii(),
]
});
static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> =
once_cell::sync::Lazy::new(|| {
[
Capsules3D::descriptor_translations(),
Capsules3D::descriptor_colors(),
Capsules3D::descriptor_indicator(),
]
});
static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> =
once_cell::sync::Lazy::new(|| {
[
Capsules3D::descriptor_rotation_axis_angles(),
Capsules3D::descriptor_quaternions(),
Capsules3D::descriptor_labels(),
Capsules3D::descriptor_show_labels(),
Capsules3D::descriptor_class_ids(),
]
});
static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 10usize]> =
once_cell::sync::Lazy::new(|| {
[
Capsules3D::descriptor_lengths(),
Capsules3D::descriptor_radii(),
Capsules3D::descriptor_translations(),
Capsules3D::descriptor_colors(),
Capsules3D::descriptor_indicator(),
Capsules3D::descriptor_rotation_axis_angles(),
Capsules3D::descriptor_quaternions(),
Capsules3D::descriptor_labels(),
Capsules3D::descriptor_show_labels(),
Capsules3D::descriptor_class_ids(),
]
});
impl Capsules3D {
pub const NUM_COMPONENTS: usize = 10usize;
}
pub type Capsules3DIndicator = ::re_types_core::GenericIndicatorComponent<Capsules3D>;
impl ::re_types_core::Archetype for Capsules3D {
type Indicator = Capsules3DIndicator;
#[inline]
fn name() -> ::re_types_core::ArchetypeName {
"rerun.archetypes.Capsules3D".into()
}
#[inline]
fn display_name() -> &'static str {
"Capsules 3D"
}
#[inline]
fn indicator() -> SerializedComponentBatch {
#[allow(clippy::unwrap_used)]
Capsules3DIndicator::DEFAULT.serialized().unwrap()
}
#[inline]
fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
REQUIRED_COMPONENTS.as_slice().into()
}
#[inline]
fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
RECOMMENDED_COMPONENTS.as_slice().into()
}
#[inline]
fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
OPTIONAL_COMPONENTS.as_slice().into()
}
#[inline]
fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
ALL_COMPONENTS.as_slice().into()
}
#[inline]
fn from_arrow_components(
arrow_data: impl IntoIterator<Item = (ComponentDescriptor, arrow::array::ArrayRef)>,
) -> DeserializationResult<Self> {
re_tracing::profile_function!();
use ::re_types_core::{Loggable as _, ResultExt as _};
let arrays_by_descr: ::nohash_hasher::IntMap<_, _> = arrow_data.into_iter().collect();
let lengths = arrays_by_descr
.get(&Self::descriptor_lengths())
.map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_lengths()));
let radii = arrays_by_descr
.get(&Self::descriptor_radii())
.map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_radii()));
let translations = arrays_by_descr
.get(&Self::descriptor_translations())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_translations())
});
let rotation_axis_angles = arrays_by_descr
.get(&Self::descriptor_rotation_axis_angles())
.map(|array| {
SerializedComponentBatch::new(
array.clone(),
Self::descriptor_rotation_axis_angles(),
)
});
let quaternions = arrays_by_descr
.get(&Self::descriptor_quaternions())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_quaternions())
});
let colors = arrays_by_descr
.get(&Self::descriptor_colors())
.map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_colors()));
let labels = arrays_by_descr
.get(&Self::descriptor_labels())
.map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_labels()));
let show_labels = arrays_by_descr
.get(&Self::descriptor_show_labels())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_show_labels())
});
let class_ids = arrays_by_descr
.get(&Self::descriptor_class_ids())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_class_ids())
});
Ok(Self {
lengths,
radii,
translations,
rotation_axis_angles,
quaternions,
colors,
labels,
show_labels,
class_ids,
})
}
}
impl ::re_types_core::AsComponents for Capsules3D {
#[inline]
fn as_serialized_batches(&self) -> Vec<SerializedComponentBatch> {
use ::re_types_core::Archetype as _;
[
Some(Self::indicator()),
self.lengths.clone(),
self.radii.clone(),
self.translations.clone(),
self.rotation_axis_angles.clone(),
self.quaternions.clone(),
self.colors.clone(),
self.labels.clone(),
self.show_labels.clone(),
self.class_ids.clone(),
]
.into_iter()
.flatten()
.collect()
}
}
impl ::re_types_core::ArchetypeReflectionMarker for Capsules3D {}
impl Capsules3D {
#[inline]
pub(crate) fn new(
lengths: impl IntoIterator<Item = impl Into<crate::components::Length>>,
radii: impl IntoIterator<Item = impl Into<crate::components::Radius>>,
) -> Self {
Self {
lengths: try_serialize_field(Self::descriptor_lengths(), lengths),
radii: try_serialize_field(Self::descriptor_radii(), radii),
translations: None,
rotation_axis_angles: None,
quaternions: None,
colors: None,
labels: None,
show_labels: None,
class_ids: None,
}
}
#[inline]
pub fn update_fields() -> Self {
Self::default()
}
#[inline]
pub fn clear_fields() -> Self {
use ::re_types_core::Loggable as _;
Self {
lengths: Some(SerializedComponentBatch::new(
crate::components::Length::arrow_empty(),
Self::descriptor_lengths(),
)),
radii: Some(SerializedComponentBatch::new(
crate::components::Radius::arrow_empty(),
Self::descriptor_radii(),
)),
translations: Some(SerializedComponentBatch::new(
crate::components::PoseTranslation3D::arrow_empty(),
Self::descriptor_translations(),
)),
rotation_axis_angles: Some(SerializedComponentBatch::new(
crate::components::PoseRotationAxisAngle::arrow_empty(),
Self::descriptor_rotation_axis_angles(),
)),
quaternions: Some(SerializedComponentBatch::new(
crate::components::PoseRotationQuat::arrow_empty(),
Self::descriptor_quaternions(),
)),
colors: Some(SerializedComponentBatch::new(
crate::components::Color::arrow_empty(),
Self::descriptor_colors(),
)),
labels: Some(SerializedComponentBatch::new(
crate::components::Text::arrow_empty(),
Self::descriptor_labels(),
)),
show_labels: Some(SerializedComponentBatch::new(
crate::components::ShowLabels::arrow_empty(),
Self::descriptor_show_labels(),
)),
class_ids: Some(SerializedComponentBatch::new(
crate::components::ClassId::arrow_empty(),
Self::descriptor_class_ids(),
)),
}
}
#[inline]
pub fn columns<I>(
self,
_lengths: I,
) -> SerializationResult<impl Iterator<Item = ::re_types_core::SerializedComponentColumn>>
where
I: IntoIterator<Item = usize> + Clone,
{
let columns = [
self.lengths
.map(|lengths| lengths.partitioned(_lengths.clone()))
.transpose()?,
self.radii
.map(|radii| radii.partitioned(_lengths.clone()))
.transpose()?,
self.translations
.map(|translations| translations.partitioned(_lengths.clone()))
.transpose()?,
self.rotation_axis_angles
.map(|rotation_axis_angles| rotation_axis_angles.partitioned(_lengths.clone()))
.transpose()?,
self.quaternions
.map(|quaternions| quaternions.partitioned(_lengths.clone()))
.transpose()?,
self.colors
.map(|colors| colors.partitioned(_lengths.clone()))
.transpose()?,
self.labels
.map(|labels| labels.partitioned(_lengths.clone()))
.transpose()?,
self.show_labels
.map(|show_labels| show_labels.partitioned(_lengths.clone()))
.transpose()?,
self.class_ids
.map(|class_ids| class_ids.partitioned(_lengths.clone()))
.transpose()?,
];
Ok(columns
.into_iter()
.flatten()
.chain([::re_types_core::indicator_column::<Self>(
_lengths.into_iter().count(),
)?]))
}
#[inline]
pub fn columns_of_unit_batches(
self,
) -> SerializationResult<impl Iterator<Item = ::re_types_core::SerializedComponentColumn>> {
let len_lengths = self.lengths.as_ref().map(|b| b.array.len());
let len_radii = self.radii.as_ref().map(|b| b.array.len());
let len_translations = self.translations.as_ref().map(|b| b.array.len());
let len_rotation_axis_angles = self.rotation_axis_angles.as_ref().map(|b| b.array.len());
let len_quaternions = self.quaternions.as_ref().map(|b| b.array.len());
let len_colors = self.colors.as_ref().map(|b| b.array.len());
let len_labels = self.labels.as_ref().map(|b| b.array.len());
let len_show_labels = self.show_labels.as_ref().map(|b| b.array.len());
let len_class_ids = self.class_ids.as_ref().map(|b| b.array.len());
let len = None
.or(len_lengths)
.or(len_radii)
.or(len_translations)
.or(len_rotation_axis_angles)
.or(len_quaternions)
.or(len_colors)
.or(len_labels)
.or(len_show_labels)
.or(len_class_ids)
.unwrap_or(0);
self.columns(std::iter::repeat(1).take(len))
}
#[inline]
pub fn with_lengths(
mut self,
lengths: impl IntoIterator<Item = impl Into<crate::components::Length>>,
) -> Self {
self.lengths = try_serialize_field(Self::descriptor_lengths(), lengths);
self
}
#[inline]
pub fn with_radii(
mut self,
radii: impl IntoIterator<Item = impl Into<crate::components::Radius>>,
) -> Self {
self.radii = try_serialize_field(Self::descriptor_radii(), radii);
self
}
#[inline]
pub fn with_translations(
mut self,
translations: impl IntoIterator<Item = impl Into<crate::components::PoseTranslation3D>>,
) -> Self {
self.translations = try_serialize_field(Self::descriptor_translations(), translations);
self
}
#[inline]
pub fn with_rotation_axis_angles(
mut self,
rotation_axis_angles: impl IntoIterator<
Item = impl Into<crate::components::PoseRotationAxisAngle>,
>,
) -> Self {
self.rotation_axis_angles = try_serialize_field(
Self::descriptor_rotation_axis_angles(),
rotation_axis_angles,
);
self
}
#[inline]
pub fn with_quaternions(
mut self,
quaternions: impl IntoIterator<Item = impl Into<crate::components::PoseRotationQuat>>,
) -> Self {
self.quaternions = try_serialize_field(Self::descriptor_quaternions(), quaternions);
self
}
#[inline]
pub fn with_colors(
mut self,
colors: impl IntoIterator<Item = impl Into<crate::components::Color>>,
) -> Self {
self.colors = try_serialize_field(Self::descriptor_colors(), colors);
self
}
#[inline]
pub fn with_labels(
mut self,
labels: impl IntoIterator<Item = impl Into<crate::components::Text>>,
) -> Self {
self.labels = try_serialize_field(Self::descriptor_labels(), labels);
self
}
#[inline]
pub fn with_show_labels(
mut self,
show_labels: impl Into<crate::components::ShowLabels>,
) -> Self {
self.show_labels = try_serialize_field(Self::descriptor_show_labels(), [show_labels]);
self
}
#[inline]
pub fn with_many_show_labels(
mut self,
show_labels: impl IntoIterator<Item = impl Into<crate::components::ShowLabels>>,
) -> Self {
self.show_labels = try_serialize_field(Self::descriptor_show_labels(), show_labels);
self
}
#[inline]
pub fn with_class_ids(
mut self,
class_ids: impl IntoIterator<Item = impl Into<crate::components::ClassId>>,
) -> Self {
self.class_ids = try_serialize_field(Self::descriptor_class_ids(), class_ids);
self
}
}
impl ::re_byte_size::SizeBytes for Capsules3D {
#[inline]
fn heap_size_bytes(&self) -> u64 {
self.lengths.heap_size_bytes()
+ self.radii.heap_size_bytes()
+ self.translations.heap_size_bytes()
+ self.rotation_axis_angles.heap_size_bytes()
+ self.quaternions.heap_size_bytes()
+ self.colors.heap_size_bytes()
+ self.labels.heap_size_bytes()
+ self.show_labels.heap_size_bytes()
+ self.class_ids.heap_size_bytes()
}
}