re_types/components/
view_coordinates.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/view_coordinates.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**: How we interpret the coordinate system of an entity/space.
23///
24/// For instance: What is "up"? What does the Z axis mean?
25///
26/// The three coordinates are always ordered as [x, y, z].
27///
28/// For example [Right, Down, Forward] means that the X axis points to the right, the Y axis points
29/// down, and the Z axis points forward.
30///
31/// ⚠ [Rerun does not yet support left-handed coordinate systems](https://github.com/rerun-io/rerun/issues/5032).
32///
33/// The following constants are used to represent the different directions:
34///  * Up = 1
35///  * Down = 2
36///  * Right = 3
37///  * Left = 4
38///  * Forward = 5
39///  * Back = 6
40///
41/// ⚠️ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
42#[derive(Clone, Debug, Copy, PartialEq, Eq, bytemuck::Pod, bytemuck::Zeroable)]
43#[repr(transparent)]
44pub struct ViewCoordinates(
45    /// The directions of the [x, y, z] axes.
46    pub crate::datatypes::ViewCoordinates,
47);
48
49impl ::re_types_core::Component for ViewCoordinates {
50    #[inline]
51    fn name() -> ComponentType {
52        "rerun.components.ViewCoordinates".into()
53    }
54}
55
56::re_types_core::macros::impl_into_cow!(ViewCoordinates);
57
58impl ::re_types_core::Loggable for ViewCoordinates {
59    #[inline]
60    fn arrow_datatype() -> arrow::datatypes::DataType {
61        crate::datatypes::ViewCoordinates::arrow_datatype()
62    }
63
64    fn to_arrow_opt<'a>(
65        data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
66    ) -> SerializationResult<arrow::array::ArrayRef>
67    where
68        Self: Clone + 'a,
69    {
70        crate::datatypes::ViewCoordinates::to_arrow_opt(data.into_iter().map(|datum| {
71            datum.map(|datum| match datum.into() {
72                ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
73                ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
74            })
75        }))
76    }
77
78    fn from_arrow_opt(
79        arrow_data: &dyn arrow::array::Array,
80    ) -> DeserializationResult<Vec<Option<Self>>>
81    where
82        Self: Sized,
83    {
84        crate::datatypes::ViewCoordinates::from_arrow_opt(arrow_data)
85            .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
86    }
87
88    #[inline]
89    fn from_arrow(arrow_data: &dyn arrow::array::Array) -> DeserializationResult<Vec<Self>>
90    where
91        Self: Sized,
92    {
93        crate::datatypes::ViewCoordinates::from_arrow(arrow_data).map(bytemuck::cast_vec)
94    }
95}
96
97impl<T: Into<crate::datatypes::ViewCoordinates>> From<T> for ViewCoordinates {
98    fn from(v: T) -> Self {
99        Self(v.into())
100    }
101}
102
103impl std::borrow::Borrow<crate::datatypes::ViewCoordinates> for ViewCoordinates {
104    #[inline]
105    fn borrow(&self) -> &crate::datatypes::ViewCoordinates {
106        &self.0
107    }
108}
109
110impl std::ops::Deref for ViewCoordinates {
111    type Target = crate::datatypes::ViewCoordinates;
112
113    #[inline]
114    fn deref(&self) -> &crate::datatypes::ViewCoordinates {
115        &self.0
116    }
117}
118
119impl std::ops::DerefMut for ViewCoordinates {
120    #[inline]
121    fn deref_mut(&mut self) -> &mut crate::datatypes::ViewCoordinates {
122        &mut self.0
123    }
124}
125
126impl ::re_byte_size::SizeBytes for ViewCoordinates {
127    #[inline]
128    fn heap_size_bytes(&self) -> u64 {
129        self.0.heap_size_bytes()
130    }
131
132    #[inline]
133    fn is_pod() -> bool {
134        <crate::datatypes::ViewCoordinates>::is_pod()
135    }
136}