re_types/blueprint/archetypes/
visualizer_overrides.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)]
36pub struct VisualizerOverrides {
37 pub ranges: Option<SerializedComponentBatch>,
39}
40
41impl VisualizerOverrides {
42 #[inline]
46 pub fn descriptor_ranges() -> ComponentDescriptor {
47 ComponentDescriptor {
48 archetype: Some("rerun.blueprint.archetypes.VisualizerOverrides".into()),
49 component: "VisualizerOverrides:ranges".into(),
50 component_type: Some("rerun.blueprint.components.VisualizerOverride".into()),
51 }
52 }
53}
54
55static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> =
56 once_cell::sync::Lazy::new(|| [VisualizerOverrides::descriptor_ranges()]);
57
58static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> =
59 once_cell::sync::Lazy::new(|| []);
60
61static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> =
62 once_cell::sync::Lazy::new(|| []);
63
64static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> =
65 once_cell::sync::Lazy::new(|| [VisualizerOverrides::descriptor_ranges()]);
66
67impl VisualizerOverrides {
68 pub const NUM_COMPONENTS: usize = 1usize;
70}
71
72impl ::re_types_core::Archetype for VisualizerOverrides {
73 #[inline]
74 fn name() -> ::re_types_core::ArchetypeName {
75 "rerun.blueprint.archetypes.VisualizerOverrides".into()
76 }
77
78 #[inline]
79 fn display_name() -> &'static str {
80 "Visualizer overrides"
81 }
82
83 #[inline]
84 fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
85 REQUIRED_COMPONENTS.as_slice().into()
86 }
87
88 #[inline]
89 fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
90 RECOMMENDED_COMPONENTS.as_slice().into()
91 }
92
93 #[inline]
94 fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
95 OPTIONAL_COMPONENTS.as_slice().into()
96 }
97
98 #[inline]
99 fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
100 ALL_COMPONENTS.as_slice().into()
101 }
102
103 #[inline]
104 fn from_arrow_components(
105 arrow_data: impl IntoIterator<Item = (ComponentDescriptor, arrow::array::ArrayRef)>,
106 ) -> DeserializationResult<Self> {
107 re_tracing::profile_function!();
108 use ::re_types_core::{Loggable as _, ResultExt as _};
109 let arrays_by_descr: ::nohash_hasher::IntMap<_, _> = arrow_data.into_iter().collect();
110 let ranges = arrays_by_descr
111 .get(&Self::descriptor_ranges())
112 .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_ranges()));
113 Ok(Self { ranges })
114 }
115}
116
117impl ::re_types_core::AsComponents for VisualizerOverrides {
118 #[inline]
119 fn as_serialized_batches(&self) -> Vec<SerializedComponentBatch> {
120 use ::re_types_core::Archetype as _;
121 std::iter::once(self.ranges.clone()).flatten().collect()
122 }
123}
124
125impl ::re_types_core::ArchetypeReflectionMarker for VisualizerOverrides {}
126
127impl VisualizerOverrides {
128 #[inline]
130 pub fn new(
131 ranges: impl IntoIterator<Item = impl Into<crate::blueprint::components::VisualizerOverride>>,
132 ) -> Self {
133 Self {
134 ranges: try_serialize_field(Self::descriptor_ranges(), ranges),
135 }
136 }
137
138 #[inline]
140 pub fn update_fields() -> Self {
141 Self::default()
142 }
143
144 #[inline]
146 pub fn clear_fields() -> Self {
147 use ::re_types_core::Loggable as _;
148 Self {
149 ranges: Some(SerializedComponentBatch::new(
150 crate::blueprint::components::VisualizerOverride::arrow_empty(),
151 Self::descriptor_ranges(),
152 )),
153 }
154 }
155
156 #[inline]
158 pub fn with_ranges(
159 mut self,
160 ranges: impl IntoIterator<Item = impl Into<crate::blueprint::components::VisualizerOverride>>,
161 ) -> Self {
162 self.ranges = try_serialize_field(Self::descriptor_ranges(), ranges);
163 self
164 }
165}
166
167impl ::re_byte_size::SizeBytes for VisualizerOverrides {
168 #[inline]
169 fn heap_size_bytes(&self) -> u64 {
170 self.ranges.heap_size_bytes()
171 }
172}