re_types/components/
tensor_dimension_index_selection.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/components/tensor_dimension_selection.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**: Specifies a concrete index on a tensor dimension.
22#[derive(Clone, Debug, Hash, Copy, PartialEq, Eq, Default)]
23#[repr(transparent)]
24pub struct TensorDimensionIndexSelection(pub crate::datatypes::TensorDimensionIndexSelection);
25
26impl ::re_types_core::Component for TensorDimensionIndexSelection {
27    #[inline]
28    fn descriptor() -> ComponentDescriptor {
29        ComponentDescriptor::new("rerun.components.TensorDimensionIndexSelection")
30    }
31}
32
33::re_types_core::macros::impl_into_cow!(TensorDimensionIndexSelection);
34
35impl ::re_types_core::Loggable for TensorDimensionIndexSelection {
36    #[inline]
37    fn arrow_datatype() -> arrow::datatypes::DataType {
38        crate::datatypes::TensorDimensionIndexSelection::arrow_datatype()
39    }
40
41    fn to_arrow_opt<'a>(
42        data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
43    ) -> SerializationResult<arrow::array::ArrayRef>
44    where
45        Self: Clone + 'a,
46    {
47        crate::datatypes::TensorDimensionIndexSelection::to_arrow_opt(data.into_iter().map(
48            |datum| {
49                datum.map(|datum| match datum.into() {
50                    ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
51                    ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
52                })
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::TensorDimensionIndexSelection::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::TensorDimensionIndexSelection>> From<T>
69    for TensorDimensionIndexSelection
70{
71    fn from(v: T) -> Self {
72        Self(v.into())
73    }
74}
75
76impl std::borrow::Borrow<crate::datatypes::TensorDimensionIndexSelection>
77    for TensorDimensionIndexSelection
78{
79    #[inline]
80    fn borrow(&self) -> &crate::datatypes::TensorDimensionIndexSelection {
81        &self.0
82    }
83}
84
85impl std::ops::Deref for TensorDimensionIndexSelection {
86    type Target = crate::datatypes::TensorDimensionIndexSelection;
87
88    #[inline]
89    fn deref(&self) -> &crate::datatypes::TensorDimensionIndexSelection {
90        &self.0
91    }
92}
93
94impl std::ops::DerefMut for TensorDimensionIndexSelection {
95    #[inline]
96    fn deref_mut(&mut self) -> &mut crate::datatypes::TensorDimensionIndexSelection {
97        &mut self.0
98    }
99}
100
101impl ::re_byte_size::SizeBytes for TensorDimensionIndexSelection {
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::TensorDimensionIndexSelection>::is_pod()
110    }
111}