re_types/components/
pose_rotation_axis_angle.rs

1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs
2// Based on "crates/store/re_types/definitions/rerun/components/rotation_axis_angle.fbs".
3
4#![allow(unused_braces)]
5#![allow(unused_imports)]
6#![allow(unused_parens)]
7#![allow(clippy::clone_on_copy)]
8#![allow(clippy::cloned_instead_of_copied)]
9#![allow(clippy::map_flatten)]
10#![allow(clippy::needless_question_mark)]
11#![allow(clippy::new_without_default)]
12#![allow(clippy::redundant_closure)]
13#![allow(clippy::too_many_arguments)]
14#![allow(clippy::too_many_lines)]
15
16use ::re_types_core::try_serialize_field;
17use ::re_types_core::SerializationResult;
18use ::re_types_core::{ComponentBatch as _, SerializedComponentBatch};
19use ::re_types_core::{ComponentDescriptor, ComponentType};
20use ::re_types_core::{DeserializationError, DeserializationResult};
21
22/// **Component**: 3D rotation represented by a rotation around a given axis that doesn't propagate in the transform hierarchy.
23///
24/// If normalization of the rotation axis fails the rotation is treated as an invalid transform, unless the
25/// angle is zero in which case it is treated as an identity.
26#[derive(Clone, Debug, Default, Copy, PartialEq)]
27#[repr(transparent)]
28pub struct PoseRotationAxisAngle(pub crate::datatypes::RotationAxisAngle);
29
30impl ::re_types_core::Component for PoseRotationAxisAngle {
31    #[inline]
32    fn name() -> ComponentType {
33        "rerun.components.PoseRotationAxisAngle".into()
34    }
35}
36
37::re_types_core::macros::impl_into_cow!(PoseRotationAxisAngle);
38
39impl ::re_types_core::Loggable for PoseRotationAxisAngle {
40    #[inline]
41    fn arrow_datatype() -> arrow::datatypes::DataType {
42        crate::datatypes::RotationAxisAngle::arrow_datatype()
43    }
44
45    fn to_arrow_opt<'a>(
46        data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
47    ) -> SerializationResult<arrow::array::ArrayRef>
48    where
49        Self: Clone + 'a,
50    {
51        crate::datatypes::RotationAxisAngle::to_arrow_opt(data.into_iter().map(|datum| {
52            datum.map(|datum| match datum.into() {
53                ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
54                ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
55            })
56        }))
57    }
58
59    fn from_arrow_opt(
60        arrow_data: &dyn arrow::array::Array,
61    ) -> DeserializationResult<Vec<Option<Self>>>
62    where
63        Self: Sized,
64    {
65        crate::datatypes::RotationAxisAngle::from_arrow_opt(arrow_data)
66            .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
67    }
68}
69
70impl<T: Into<crate::datatypes::RotationAxisAngle>> From<T> for PoseRotationAxisAngle {
71    fn from(v: T) -> Self {
72        Self(v.into())
73    }
74}
75
76impl std::borrow::Borrow<crate::datatypes::RotationAxisAngle> for PoseRotationAxisAngle {
77    #[inline]
78    fn borrow(&self) -> &crate::datatypes::RotationAxisAngle {
79        &self.0
80    }
81}
82
83impl std::ops::Deref for PoseRotationAxisAngle {
84    type Target = crate::datatypes::RotationAxisAngle;
85
86    #[inline]
87    fn deref(&self) -> &crate::datatypes::RotationAxisAngle {
88        &self.0
89    }
90}
91
92impl std::ops::DerefMut for PoseRotationAxisAngle {
93    #[inline]
94    fn deref_mut(&mut self) -> &mut crate::datatypes::RotationAxisAngle {
95        &mut self.0
96    }
97}
98
99impl ::re_byte_size::SizeBytes for PoseRotationAxisAngle {
100    #[inline]
101    fn heap_size_bytes(&self) -> u64 {
102        self.0.heap_size_bytes()
103    }
104
105    #[inline]
106    fn is_pod() -> bool {
107        <crate::datatypes::RotationAxisAngle>::is_pod()
108    }
109}