re_types/blueprint/components/
active_tab.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/active_tab.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**: The active tab in a tabbed container.
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, Default)]
25pub struct ActiveTab(
26    /// Which tab is currently active.
27    ///
28    /// This should always correspond to a tab in the container.
29    pub crate::datatypes::EntityPath,
30);
31
32impl ::re_types_core::Component for ActiveTab {
33    #[inline]
34    fn descriptor() -> ComponentDescriptor {
35        ComponentDescriptor::new("rerun.blueprint.components.ActiveTab")
36    }
37}
38
39::re_types_core::macros::impl_into_cow!(ActiveTab);
40
41impl ::re_types_core::Loggable for ActiveTab {
42    #[inline]
43    fn arrow_datatype() -> arrow::datatypes::DataType {
44        crate::datatypes::EntityPath::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::EntityPath::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::EntityPath::from_arrow_opt(arrow_data)
68            .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
69    }
70}
71
72impl<T: Into<crate::datatypes::EntityPath>> From<T> for ActiveTab {
73    fn from(v: T) -> Self {
74        Self(v.into())
75    }
76}
77
78impl std::borrow::Borrow<crate::datatypes::EntityPath> for ActiveTab {
79    #[inline]
80    fn borrow(&self) -> &crate::datatypes::EntityPath {
81        &self.0
82    }
83}
84
85impl std::ops::Deref for ActiveTab {
86    type Target = crate::datatypes::EntityPath;
87
88    #[inline]
89    fn deref(&self) -> &crate::datatypes::EntityPath {
90        &self.0
91    }
92}
93
94impl std::ops::DerefMut for ActiveTab {
95    #[inline]
96    fn deref_mut(&mut self) -> &mut crate::datatypes::EntityPath {
97        &mut self.0
98    }
99}
100
101impl ::re_byte_size::SizeBytes for ActiveTab {
102    #[inline]
103    fn heap_size_bytes(&self) -> u64 {
104        self.0.heap_size_bytes()
105    }
106
107    #[inline]
108    fn is_pod() -> bool {
109        <crate::datatypes::EntityPath>::is_pod()
110    }
111}