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