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