re_types/blueprint/components/
row_share.rs

1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs
2// Based on "crates/store/re_types/definitions/rerun/blueprint/components/row_share.fbs".
3
4#![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/// **Component**: The layout share of a row in the container.
23///
24/// ⚠️ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
25#[derive(Clone, Debug, Default)]
26pub struct RowShare(
27    /// The layout share of a row in the container.
28    pub crate::datatypes::Float32,
29);
30
31impl ::re_types_core::Component for RowShare {
32    #[inline]
33    fn name() -> ComponentType {
34        "rerun.blueprint.components.RowShare".into()
35    }
36}
37
38::re_types_core::macros::impl_into_cow!(RowShare);
39
40impl ::re_types_core::Loggable for RowShare {
41    #[inline]
42    fn arrow_datatype() -> arrow::datatypes::DataType {
43        crate::datatypes::Float32::arrow_datatype()
44    }
45
46    fn to_arrow_opt<'a>(
47        data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
48    ) -> SerializationResult<arrow::array::ArrayRef>
49    where
50        Self: Clone + 'a,
51    {
52        crate::datatypes::Float32::to_arrow_opt(data.into_iter().map(|datum| {
53            datum.map(|datum| match datum.into() {
54                ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
55                ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
56            })
57        }))
58    }
59
60    fn from_arrow_opt(
61        arrow_data: &dyn arrow::array::Array,
62    ) -> DeserializationResult<Vec<Option<Self>>>
63    where
64        Self: Sized,
65    {
66        crate::datatypes::Float32::from_arrow_opt(arrow_data)
67            .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
68    }
69
70    #[inline]
71    fn from_arrow(arrow_data: &dyn arrow::array::Array) -> DeserializationResult<Vec<Self>>
72    where
73        Self: Sized,
74    {
75        crate::datatypes::Float32::from_arrow(arrow_data).map(|v| v.into_iter().map(Self).collect())
76    }
77}
78
79impl<T: Into<crate::datatypes::Float32>> From<T> for RowShare {
80    fn from(v: T) -> Self {
81        Self(v.into())
82    }
83}
84
85impl std::borrow::Borrow<crate::datatypes::Float32> for RowShare {
86    #[inline]
87    fn borrow(&self) -> &crate::datatypes::Float32 {
88        &self.0
89    }
90}
91
92impl std::ops::Deref for RowShare {
93    type Target = crate::datatypes::Float32;
94
95    #[inline]
96    fn deref(&self) -> &crate::datatypes::Float32 {
97        &self.0
98    }
99}
100
101impl std::ops::DerefMut for RowShare {
102    #[inline]
103    fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 {
104        &mut self.0
105    }
106}
107
108impl ::re_byte_size::SizeBytes for RowShare {
109    #[inline]
110    fn heap_size_bytes(&self) -> u64 {
111        self.0.heap_size_bytes()
112    }
113
114    #[inline]
115    fn is_pod() -> bool {
116        <crate::datatypes::Float32>::is_pod()
117    }
118}