re_types/blueprint/components/
visual_bounds2d.rs1#![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#[derive(Clone, Debug, Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable)]
25#[repr(transparent)]
26pub struct VisualBounds2D(
27 pub crate::datatypes::Range2D,
29);
30
31impl ::re_types_core::Component for VisualBounds2D {
32 #[inline]
33 fn descriptor() -> ComponentDescriptor {
34 ComponentDescriptor::new("rerun.blueprint.components.VisualBounds2D")
35 }
36}
37
38::re_types_core::macros::impl_into_cow!(VisualBounds2D);
39
40impl ::re_types_core::Loggable for VisualBounds2D {
41 #[inline]
42 fn arrow_datatype() -> arrow::datatypes::DataType {
43 crate::datatypes::Range2D::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::Range2D::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::Range2D::from_arrow_opt(arrow_data)
67 .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
68 }
69}
70
71impl<T: Into<crate::datatypes::Range2D>> From<T> for VisualBounds2D {
72 fn from(v: T) -> Self {
73 Self(v.into())
74 }
75}
76
77impl std::borrow::Borrow<crate::datatypes::Range2D> for VisualBounds2D {
78 #[inline]
79 fn borrow(&self) -> &crate::datatypes::Range2D {
80 &self.0
81 }
82}
83
84impl std::ops::Deref for VisualBounds2D {
85 type Target = crate::datatypes::Range2D;
86
87 #[inline]
88 fn deref(&self) -> &crate::datatypes::Range2D {
89 &self.0
90 }
91}
92
93impl std::ops::DerefMut for VisualBounds2D {
94 #[inline]
95 fn deref_mut(&mut self) -> &mut crate::datatypes::Range2D {
96 &mut self.0
97 }
98}
99
100impl ::re_byte_size::SizeBytes for VisualBounds2D {
101 #[inline]
102 fn heap_size_bytes(&self) -> u64 {
103 self.0.heap_size_bytes()
104 }
105
106 #[inline]
107 fn is_pod() -> bool {
108 <crate::datatypes::Range2D>::is_pod()
109 }
110}