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