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