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