re_types/blueprint/archetypes/
visual_bounds2d.rs1#![allow(unused_braces)]
5#![allow(unused_imports)]
6#![allow(unused_parens)]
7#![allow(clippy::clone_on_copy)]
8#![allow(clippy::cloned_instead_of_copied)]
9#![allow(clippy::map_flatten)]
10#![allow(clippy::needless_question_mark)]
11#![allow(clippy::new_without_default)]
12#![allow(clippy::redundant_closure)]
13#![allow(clippy::too_many_arguments)]
14#![allow(clippy::too_many_lines)]
15
16use ::re_types_core::try_serialize_field;
17use ::re_types_core::SerializationResult;
18use ::re_types_core::{ComponentBatch as _, SerializedComponentBatch};
19use ::re_types_core::{ComponentDescriptor, ComponentType};
20use ::re_types_core::{DeserializationError, DeserializationResult};
21
22#[derive(Clone, Debug, Default)]
32pub struct VisualBounds2D {
33 pub range: Option<SerializedComponentBatch>,
37}
38
39impl VisualBounds2D {
40 #[inline]
44 pub fn descriptor_range() -> ComponentDescriptor {
45 ComponentDescriptor {
46 archetype: Some("rerun.blueprint.archetypes.VisualBounds2D".into()),
47 component: "VisualBounds2D:range".into(),
48 component_type: Some("rerun.blueprint.components.VisualBounds2D".into()),
49 }
50 }
51}
52
53static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> =
54 once_cell::sync::Lazy::new(|| [VisualBounds2D::descriptor_range()]);
55
56static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> =
57 once_cell::sync::Lazy::new(|| []);
58
59static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> =
60 once_cell::sync::Lazy::new(|| []);
61
62static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> =
63 once_cell::sync::Lazy::new(|| [VisualBounds2D::descriptor_range()]);
64
65impl VisualBounds2D {
66 pub const NUM_COMPONENTS: usize = 1usize;
68}
69
70impl ::re_types_core::Archetype for VisualBounds2D {
71 #[inline]
72 fn name() -> ::re_types_core::ArchetypeName {
73 "rerun.blueprint.archetypes.VisualBounds2D".into()
74 }
75
76 #[inline]
77 fn display_name() -> &'static str {
78 "Visual bounds 2D"
79 }
80
81 #[inline]
82 fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
83 REQUIRED_COMPONENTS.as_slice().into()
84 }
85
86 #[inline]
87 fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
88 RECOMMENDED_COMPONENTS.as_slice().into()
89 }
90
91 #[inline]
92 fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
93 OPTIONAL_COMPONENTS.as_slice().into()
94 }
95
96 #[inline]
97 fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
98 ALL_COMPONENTS.as_slice().into()
99 }
100
101 #[inline]
102 fn from_arrow_components(
103 arrow_data: impl IntoIterator<Item = (ComponentDescriptor, arrow::array::ArrayRef)>,
104 ) -> DeserializationResult<Self> {
105 re_tracing::profile_function!();
106 use ::re_types_core::{Loggable as _, ResultExt as _};
107 let arrays_by_descr: ::nohash_hasher::IntMap<_, _> = arrow_data.into_iter().collect();
108 let range = arrays_by_descr
109 .get(&Self::descriptor_range())
110 .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_range()));
111 Ok(Self { range })
112 }
113}
114
115impl ::re_types_core::AsComponents for VisualBounds2D {
116 #[inline]
117 fn as_serialized_batches(&self) -> Vec<SerializedComponentBatch> {
118 use ::re_types_core::Archetype as _;
119 std::iter::once(self.range.clone()).flatten().collect()
120 }
121}
122
123impl ::re_types_core::ArchetypeReflectionMarker for VisualBounds2D {}
124
125impl VisualBounds2D {
126 #[inline]
128 pub fn new(range: impl Into<crate::blueprint::components::VisualBounds2D>) -> Self {
129 Self {
130 range: try_serialize_field(Self::descriptor_range(), [range]),
131 }
132 }
133
134 #[inline]
136 pub fn update_fields() -> Self {
137 Self::default()
138 }
139
140 #[inline]
142 pub fn clear_fields() -> Self {
143 use ::re_types_core::Loggable as _;
144 Self {
145 range: Some(SerializedComponentBatch::new(
146 crate::blueprint::components::VisualBounds2D::arrow_empty(),
147 Self::descriptor_range(),
148 )),
149 }
150 }
151
152 #[inline]
156 pub fn with_range(
157 mut self,
158 range: impl Into<crate::blueprint::components::VisualBounds2D>,
159 ) -> Self {
160 self.range = try_serialize_field(Self::descriptor_range(), [range]);
161 self
162 }
163}
164
165impl ::re_byte_size::SizeBytes for VisualBounds2D {
166 #[inline]
167 fn heap_size_bytes(&self) -> u64 {
168 self.range.heap_size_bytes()
169 }
170}