re_types/components/
gamma_correction.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)]
29#[repr(transparent)]
30pub struct GammaCorrection(pub crate::datatypes::Float32);
31
32impl ::re_types_core::Component for GammaCorrection {
33 #[inline]
34 fn descriptor() -> ComponentDescriptor {
35 ComponentDescriptor::new("rerun.components.GammaCorrection")
36 }
37}
38
39::re_types_core::macros::impl_into_cow!(GammaCorrection);
40
41impl ::re_types_core::Loggable for GammaCorrection {
42 #[inline]
43 fn arrow_datatype() -> arrow::datatypes::DataType {
44 crate::datatypes::Float32::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::Float32::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::Float32::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::Float32::from_arrow(arrow_data).map(bytemuck::cast_vec)
77 }
78}
79
80impl<T: Into<crate::datatypes::Float32>> From<T> for GammaCorrection {
81 fn from(v: T) -> Self {
82 Self(v.into())
83 }
84}
85
86impl std::borrow::Borrow<crate::datatypes::Float32> for GammaCorrection {
87 #[inline]
88 fn borrow(&self) -> &crate::datatypes::Float32 {
89 &self.0
90 }
91}
92
93impl std::ops::Deref for GammaCorrection {
94 type Target = crate::datatypes::Float32;
95
96 #[inline]
97 fn deref(&self) -> &crate::datatypes::Float32 {
98 &self.0
99 }
100}
101
102impl std::ops::DerefMut for GammaCorrection {
103 #[inline]
104 fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 {
105 &mut self.0
106 }
107}
108
109impl ::re_byte_size::SizeBytes for GammaCorrection {
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::Float32>::is_pod()
118 }
119}