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