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