re_types/components/
view_coordinates.rs1#![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#[derive(Clone, Debug, Copy, PartialEq, Eq, bytemuck::Pod, bytemuck::Zeroable)]
42#[repr(transparent)]
43pub struct ViewCoordinates(
44 pub crate::datatypes::ViewCoordinates,
46);
47
48impl ::re_types_core::Component for ViewCoordinates {
49 #[inline]
50 fn descriptor() -> ComponentDescriptor {
51 ComponentDescriptor::new("rerun.components.ViewCoordinates")
52 }
53}
54
55::re_types_core::macros::impl_into_cow!(ViewCoordinates);
56
57impl ::re_types_core::Loggable for ViewCoordinates {
58 #[inline]
59 fn arrow_datatype() -> arrow::datatypes::DataType {
60 crate::datatypes::ViewCoordinates::arrow_datatype()
61 }
62
63 fn to_arrow_opt<'a>(
64 data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
65 ) -> SerializationResult<arrow::array::ArrayRef>
66 where
67 Self: Clone + 'a,
68 {
69 crate::datatypes::ViewCoordinates::to_arrow_opt(data.into_iter().map(|datum| {
70 datum.map(|datum| match datum.into() {
71 ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
72 ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
73 })
74 }))
75 }
76
77 fn from_arrow_opt(
78 arrow_data: &dyn arrow::array::Array,
79 ) -> DeserializationResult<Vec<Option<Self>>>
80 where
81 Self: Sized,
82 {
83 crate::datatypes::ViewCoordinates::from_arrow_opt(arrow_data)
84 .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
85 }
86
87 #[inline]
88 fn from_arrow(arrow_data: &dyn arrow::array::Array) -> DeserializationResult<Vec<Self>>
89 where
90 Self: Sized,
91 {
92 crate::datatypes::ViewCoordinates::from_arrow(arrow_data).map(bytemuck::cast_vec)
93 }
94}
95
96impl<T: Into<crate::datatypes::ViewCoordinates>> From<T> for ViewCoordinates {
97 fn from(v: T) -> Self {
98 Self(v.into())
99 }
100}
101
102impl std::borrow::Borrow<crate::datatypes::ViewCoordinates> for ViewCoordinates {
103 #[inline]
104 fn borrow(&self) -> &crate::datatypes::ViewCoordinates {
105 &self.0
106 }
107}
108
109impl std::ops::Deref for ViewCoordinates {
110 type Target = crate::datatypes::ViewCoordinates;
111
112 #[inline]
113 fn deref(&self) -> &crate::datatypes::ViewCoordinates {
114 &self.0
115 }
116}
117
118impl std::ops::DerefMut for ViewCoordinates {
119 #[inline]
120 fn deref_mut(&mut self) -> &mut crate::datatypes::ViewCoordinates {
121 &mut self.0
122 }
123}
124
125impl ::re_byte_size::SizeBytes for ViewCoordinates {
126 #[inline]
127 fn heap_size_bytes(&self) -> u64 {
128 self.0.heap_size_bytes()
129 }
130
131 #[inline]
132 fn is_pod() -> bool {
133 <crate::datatypes::ViewCoordinates>::is_pod()
134 }
135}