diff --git a/Cargo.lock b/Cargo.lock index a5d7e947a8210..0b10a3e11791b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8021,6 +8021,7 @@ dependencies = [ "re_build_tools", "rerun", "rust-format", + "similar-asserts", ] [[package]] diff --git a/crates/build/re_types_builder/src/codegen/rust/api.rs b/crates/build/re_types_builder/src/codegen/rust/api.rs index 3c10c6260b769..42bded753bf03 100644 --- a/crates/build/re_types_builder/src/codegen/rust/api.rs +++ b/crates/build/re_types_builder/src/codegen/rust/api.rs @@ -16,7 +16,7 @@ use crate::{ should_optimize_buffer_slice_deserialize, }, serializer::quote_arrow_serializer, - util::{is_tuple_struct_from_obj, iter_archetype_components, quote_doc_line}, + util::{is_tuple_struct_from_obj, quote_doc_line}, }, Target, }, @@ -184,7 +184,7 @@ fn generate_object_file( code.push_str("use ::re_types_core::external::arrow2;\n"); code.push_str("use ::re_types_core::SerializationResult;\n"); code.push_str("use ::re_types_core::{DeserializationResult, DeserializationError};\n"); - code.push_str("use ::re_types_core::ComponentName;\n"); + code.push_str("use ::re_types_core::{ComponentDescriptor, ComponentName};\n"); code.push_str("use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch};\n"); // NOTE: `TokenStream`s discard whitespacing information by definition, so we need to @@ -354,13 +354,13 @@ fn quote_struct( #quoted_deprecation_notice #quoted_struct - #quoted_heap_size_bytes + #quoted_trait_impls #quoted_from_impl - #quoted_trait_impls - #quoted_builder + + #quoted_heap_size_bytes }; tokens @@ -470,9 +470,9 @@ fn quote_union( #(#quoted_fields,)* } - #quoted_heap_size_bytes - #quoted_trait_impls + + #quoted_heap_size_bytes }; tokens @@ -603,6 +603,18 @@ fn quote_enum( #(#quoted_fields,)* } + #quoted_trait_impls + + // We implement `Display` to match the `PascalCase` name so that + // the enum variants are displayed in the UI exactly how they are displayed in code. + impl std::fmt::Display for #name { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + #(#display_match_arms,)* + } + } + } + impl ::re_types_core::reflection::Enum for #name { #[inline] @@ -629,18 +641,6 @@ fn quote_enum( true } } - - // We implement `Display` to match the `PascalCase` name so that - // the enum variants are displayed in the UI exactly how they are displayed in code. - impl std::fmt::Display for #name { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - #(#display_match_arms,)* - } - } - } - - #quoted_trait_impls }; tokens @@ -1006,14 +1006,16 @@ fn quote_trait_impls_for_datatype_or_component( quote! { impl ::re_types_core::Component for #name { #[inline] - fn name() -> ComponentName { - #fqname.into() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new(#fqname) } } } }); quote! { + #quoted_impl_component + ::re_types_core::macros::impl_into_cow!(#name); impl ::re_types_core::Loggable for #name { @@ -1033,8 +1035,6 @@ fn quote_trait_impls_for_datatype_or_component( #quoted_from_arrow2 } - - #quoted_impl_component } } @@ -1048,40 +1048,70 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream { assert_eq!(kind, &ObjectKind::Archetype); let display_name = re_case::to_human_case(name); + let archetype_name = &obj.fqname; let name = format_ident!("{name}"); - fn compute_components( + fn compute_component_descriptors( obj: &Object, - attr: &'static str, - extras: impl IntoIterator, + requirement_attr_value: &'static str, ) -> (usize, TokenStream) { - let components = iter_archetype_components(obj, attr) - .chain(extras) - // Do *not* sort again, we want to preserve the order given by the datatype definition - .collect::>(); + let descriptors = obj + .fields + .iter() + .filter_map(move |field| { + field + .try_get_attr::(requirement_attr_value) + .map(|_| { + let Some(component_name) = field.typ.fqname() else { + panic!("Archetype field must be an object/union or an array/vector of such") + }; + + let archetype_name = &obj.fqname; + let archetype_field_name = field.snake_case_name(); + + quote!(ComponentDescriptor { + archetype_name: Some(#archetype_name.into()), + component_name: #component_name.into(), + archetype_field_name: Some(#archetype_field_name.into()), + }) + }) + }) + .collect_vec(); - let num_components = components.len(); - let quoted_components = quote!(#(#components.into(),)*); + let num_descriptors = descriptors.len(); + let quoted_descriptors = quote!(#(#descriptors,)*); - (num_components, quoted_components) + (num_descriptors, quoted_descriptors) } let indicator_name = format!("{}Indicator", obj.name); - let indicator_fqname = format!("{}Indicator", obj.fqname).replace("archetypes", "components"); let quoted_indicator_name = format_ident!("{indicator_name}"); let quoted_indicator_doc = format!("Indicator component for the [`{name}`] [`::re_types_core::Archetype`]"); - let (num_required, required) = compute_components(obj, ATTR_RERUN_COMPONENT_REQUIRED, []); - let (num_recommended, recommended) = - compute_components(obj, ATTR_RERUN_COMPONENT_RECOMMENDED, [indicator_fqname]); - let (num_optional, optional) = compute_components(obj, ATTR_RERUN_COMPONENT_OPTIONAL, []); + let (num_required_descriptors, required_descriptors) = + compute_component_descriptors(obj, ATTR_RERUN_COMPONENT_REQUIRED); + let (mut num_recommended_descriptors, mut recommended_descriptors) = + compute_component_descriptors(obj, ATTR_RERUN_COMPONENT_RECOMMENDED); + let (num_optional_descriptors, optional_descriptors) = + compute_component_descriptors(obj, ATTR_RERUN_COMPONENT_OPTIONAL); + + num_recommended_descriptors += 1; + recommended_descriptors = quote! { + #recommended_descriptors + ComponentDescriptor { + archetype_name: Some(#archetype_name.into()), + component_name: #indicator_name.into(), + archetype_field_name: None, + }, + }; let num_components_docstring = quote_doc_line(&format!( - "The total number of components in the archetype: {num_required} required, {num_recommended} recommended, {num_optional} optional" + "The total number of components in the archetype: {num_required_descriptors} required, {num_recommended_descriptors} recommended, {num_optional_descriptors} optional" )); - let num_all = num_required + num_recommended + num_optional; + let num_all_descriptors = + num_required_descriptors + num_recommended_descriptors + num_optional_descriptors; let quoted_field_names = obj .fields @@ -1099,13 +1129,13 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream { // NOTE: The nullability we're dealing with here is the nullability of an entire array of components, // not the nullability of individual elements (i.e. instances)! - if is_nullable { + let batch = if is_nullable { if obj.attrs.has(ATTR_RERUN_LOG_MISSING_AS_EMPTY) { if is_plural { // Always log Option> as Vec, mapping None to empty batch let component_type = quote_field_type_from_typ(&obj_field.typ, false).0; quote!{ - Some(( + Some( if let Some(comp_batch) = &self.#field_name { (comp_batch as &dyn ComponentBatch) } else { @@ -1114,24 +1144,44 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream { let empty_batch: &#component_type = EMPTY_BATCH.get_or_init(|| Vec::new()); (empty_batch as &dyn ComponentBatch) } - ).into()) + ) } } else { // Always log Option, mapping None to empty batch - quote!{ Some((&self.#field_name as &dyn ComponentBatch).into()) } + quote!{ Some(&self.#field_name as &dyn ComponentBatch) } } } else { if is_plural { // Maybe logging an Option> - quote!{ self.#field_name.as_ref().map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()) } + quote!{ self.#field_name.as_ref().map(|comp_batch| (comp_batch as &dyn ComponentBatch)) } } else { // Maybe logging an Option - quote!{ self.#field_name.as_ref().map(|comp| (comp as &dyn ComponentBatch).into()) } + quote!{ self.#field_name.as_ref().map(|comp| (comp as &dyn ComponentBatch)) } } } } else { // Always logging a Vec or C - quote!{ Some((&self.#field_name as &dyn ComponentBatch).into()) } + quote!{ Some(&self.#field_name as &dyn ComponentBatch) } + }; + + let Some(component_name) = obj_field.typ.fqname() else { + panic!("Archetype field must be an object/union or an array/vector of such") + }; + let archetype_name = &obj.fqname; + let archetype_field_name = obj_field.snake_case_name(); + + quote! { + (#batch).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some(#archetype_name.into()), + archetype_field_name: Some((#archetype_field_name).into()), + component_name: (#component_name).into(), + }), + } + }) + } })) }; @@ -1215,21 +1265,21 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream { }; quote! { - static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; #num_required]> = - once_cell::sync::Lazy::new(|| {[#required]}); + static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; #num_required_descriptors]> = + once_cell::sync::Lazy::new(|| {[#required_descriptors]}); - static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; #num_recommended]> = - once_cell::sync::Lazy::new(|| {[#recommended]}); + static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; #num_recommended_descriptors]> = + once_cell::sync::Lazy::new(|| {[#recommended_descriptors]}); - static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; #num_optional]> = - once_cell::sync::Lazy::new(|| {[#optional]}); + static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; #num_optional_descriptors]> = + once_cell::sync::Lazy::new(|| {[#optional_descriptors]}); - static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; #num_all]> = - once_cell::sync::Lazy::new(|| {[#required #recommended #optional]}); + static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; #num_all_descriptors]> = + once_cell::sync::Lazy::new(|| {[#required_descriptors #recommended_descriptors #optional_descriptors]}); impl #name { #num_components_docstring - pub const NUM_COMPONENTS: usize = #num_all; + pub const NUM_COMPONENTS: usize = #num_all_descriptors; } #[doc = #quoted_indicator_doc] @@ -1251,27 +1301,27 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: #quoted_indicator_name = #quoted_indicator_name::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } // NOTE: Don't rely on default implementation so that we can keep everything static. #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -1306,7 +1356,6 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream { re_tracing::profile_function!(); use ::re_types_core::Archetype as _; - [#(#all_component_batches,)*].into_iter().flatten().collect() } } diff --git a/crates/build/re_types_builder/src/codegen/rust/util.rs b/crates/build/re_types_builder/src/codegen/rust/util.rs index 9bcaacf71b1c2..eb3e41a2661a5 100644 --- a/crates/build/re_types_builder/src/codegen/rust/util.rs +++ b/crates/build/re_types_builder/src/codegen/rust/util.rs @@ -50,25 +50,6 @@ pub fn is_tuple_struct_from_obj(obj: &Object) -> bool { is_tuple_struct } -pub fn iter_archetype_components<'a>( - obj: &'a Object, - requirement_attr_value: &'static str, -) -> impl Iterator + 'a { - assert_eq!(ObjectKind::Archetype, obj.kind); - - obj.fields.iter().filter_map(move |field| { - field - .try_get_attr::(requirement_attr_value) - .map(|_| { - if let Some(fqname) = field.typ.fqname() { - fqname.to_owned() - } else { - panic!("Archetype field must be an object/union or an array/vector of such") - } - }) - }) -} - pub fn string_from_quoted( reporter: &Reporter, acc: &TokenStream, diff --git a/crates/store/re_chunk/src/batcher.rs b/crates/store/re_chunk/src/batcher.rs index 66cd7ffd9dea1..d6cb0f38e6433 100644 --- a/crates/store/re_chunk/src/batcher.rs +++ b/crates/store/re_chunk/src/batcher.rs @@ -9,9 +9,9 @@ use crossbeam::channel::{Receiver, Sender}; use nohash_hasher::IntMap; use re_log_types::{EntityPath, ResolvedTimeRange, TimeInt, TimePoint, Timeline}; -use re_types_core::{ComponentName, SizeBytes as _}; +use re_types_core::{ComponentDescriptor, SizeBytes as _}; -use crate::{Chunk, ChunkId, ChunkResult, RowId, TimeColumn}; +use crate::{chunk::ChunkComponents, Chunk, ChunkId, ChunkResult, RowId, TimeColumn}; // --- @@ -678,14 +678,14 @@ pub struct PendingRow { /// The component data. /// /// Each array is a single component, i.e. _not_ a list array. - pub components: IntMap>, + pub components: IntMap>, } impl PendingRow { #[inline] pub fn new( timepoint: TimePoint, - components: IntMap>, + components: IntMap>, ) -> Self { Self { row_id: RowId::new(), @@ -731,13 +731,16 @@ impl PendingRow { }) .collect(); - let components = components - .into_iter() - .filter_map(|(component_name, array)| { - crate::util::arrays_to_list_array_opt(&[Some(&*array as _)]) - .map(|array| (component_name, array)) - }) - .collect(); + let mut per_name = ChunkComponents::default(); + for (component_desc, array) in components { + let list_array = crate::util::arrays_to_list_array_opt(&[Some(&*array as _)]); + if let Some(list_array) = list_array { + per_name + .entry(component_desc.component_name) + .or_default() + .insert(component_desc, list_array); + } + } Chunk::from_native_row_ids( ChunkId::new(), @@ -745,7 +748,7 @@ impl PendingRow { Some(true), &[row_id], timelines, - components, + per_name, ) } @@ -825,11 +828,11 @@ impl PendingRow { // Create all the logical list arrays that we're going to need, accounting for the // possibility of sparse components in the data. - let mut all_components: IntMap>> = + let mut all_components: IntMap>> = IntMap::default(); for row in &rows { - for component_name in row.components.keys() { - all_components.entry(*component_name).or_default(); + for component_desc in row.components.keys() { + all_components.entry(component_desc.clone()).or_default(); } } @@ -864,13 +867,21 @@ impl PendingRow { .into_iter() .map(|(timeline, time_column)| (timeline, time_column.finish())) .collect(), - std::mem::take(&mut components) - .into_iter() - .filter_map(|(component_name, arrays)| { - crate::util::arrays_to_list_array_opt(&arrays) - .map(|list_array| (component_name, list_array)) - }) - .collect(), + { + let mut per_name = ChunkComponents::default(); + for (component_desc, arrays) in std::mem::take(&mut components) + { + let list_array = + crate::util::arrays_to_list_array_opt(&arrays); + if let Some(list_array) = list_array { + per_name + .entry(component_desc.component_name) + .or_default() + .insert(component_desc, list_array); + } + } + per_name + }, )); components = all_components.clone(); @@ -886,12 +897,12 @@ impl PendingRow { time_column.push(time); } - for (component_name, arrays) in &mut components { + for (component_desc, arrays) in &mut components { // NOTE: This will push `None` if the row doesn't actually hold a value for this // component -- these are sparse list arrays! arrays.push( row_components - .get(component_name) + .get(component_desc) .map(|array| &**array as &dyn Arrow2Array), ); } @@ -906,13 +917,19 @@ impl PendingRow { .into_iter() .map(|(timeline, time_column)| (timeline, time_column.finish())) .collect(), - components - .into_iter() - .filter_map(|(component_name, arrays)| { - crate::util::arrays_to_list_array_opt(&arrays) - .map(|list_array| (component_name, list_array)) - }) - .collect(), + { + let mut per_name = ChunkComponents::default(); + for (component_desc, arrays) in components { + let list_array = crate::util::arrays_to_list_array_opt(&arrays); + if let Some(list_array) = list_array { + per_name + .entry(component_desc.component_name) + .or_default() + .insert(component_desc, list_array); + } + } + per_name + }, )); chunks @@ -1003,9 +1020,9 @@ mod tests { let points2 = MyPoint::to_arrow2([MyPoint::new(10.0, 20.0), MyPoint::new(30.0, 40.0)])?; let points3 = MyPoint::to_arrow2([MyPoint::new(100.0, 200.0), MyPoint::new(300.0, 400.0)])?; - let components1 = [(MyPoint::name(), points1.clone())]; - let components2 = [(MyPoint::name(), points2.clone())]; - let components3 = [(MyPoint::name(), points3.clone())]; + let components1 = [(MyPoint::descriptor(), points1.clone())]; + let components2 = [(MyPoint::descriptor(), points2.clone())]; + let components3 = [(MyPoint::descriptor(), points3.clone())]; let row1 = PendingRow::new(timepoint1.clone(), components1.into_iter().collect()); let row2 = PendingRow::new(timepoint2.clone(), components2.into_iter().collect()); @@ -1050,7 +1067,7 @@ mod tests { ), )]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points1, &*points2, &*points3].map(Some)) .unwrap(), )]; @@ -1082,9 +1099,9 @@ mod tests { let points2 = MyPoint::to_arrow2([MyPoint::new(10.0, 20.0), MyPoint::new(30.0, 40.0)])?; let points3 = MyPoint::to_arrow2([MyPoint::new(100.0, 200.0), MyPoint::new(300.0, 400.0)])?; - let components1 = [(MyPoint::name(), points1.clone())]; - let components2 = [(MyPoint::name(), points2.clone())]; - let components3 = [(MyPoint::name(), points3.clone())]; + let components1 = [(MyPoint::descriptor(), points1.clone())]; + let components2 = [(MyPoint::descriptor(), points2.clone())]; + let components3 = [(MyPoint::descriptor(), points3.clone())]; let row1 = PendingRow::new(timeless.clone(), components1.into_iter().collect()); let row2 = PendingRow::new(timeless.clone(), components2.into_iter().collect()); @@ -1122,7 +1139,7 @@ mod tests { let expected_row_ids = vec![row1.row_id, row2.row_id, row3.row_id]; let expected_timelines = []; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points1, &*points2, &*points3].map(Some)) .unwrap(), )]; @@ -1158,9 +1175,9 @@ mod tests { let points2 = MyPoint::to_arrow2([MyPoint::new(10.0, 20.0), MyPoint::new(30.0, 40.0)])?; let points3 = MyPoint::to_arrow2([MyPoint::new(100.0, 200.0), MyPoint::new(300.0, 400.0)])?; - let components1 = [(MyPoint::name(), points1.clone())]; - let components2 = [(MyPoint::name(), points2.clone())]; - let components3 = [(MyPoint::name(), points3.clone())]; + let components1 = [(MyPoint::descriptor(), points1.clone())]; + let components2 = [(MyPoint::descriptor(), points2.clone())]; + let components3 = [(MyPoint::descriptor(), points3.clone())]; let row1 = PendingRow::new(timepoint1.clone(), components1.into_iter().collect()); let row2 = PendingRow::new(timepoint2.clone(), components2.into_iter().collect()); @@ -1206,7 +1223,7 @@ mod tests { ), )]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points1, &*points3].map(Some)).unwrap(), )]; let expected_chunk = Chunk::from_native_row_ids( @@ -1234,7 +1251,7 @@ mod tests { ), )]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points2].map(Some)).unwrap(), )]; let expected_chunk = Chunk::from_native_row_ids( @@ -1274,9 +1291,9 @@ mod tests { let points2 = MyPoint::to_arrow2([MyPoint::new(10.0, 20.0), MyPoint::new(30.0, 40.0)])?; let points3 = MyPoint::to_arrow2([MyPoint::new(100.0, 200.0), MyPoint::new(300.0, 400.0)])?; - let components1 = [(MyPoint::name(), points1.clone())]; - let components2 = [(MyPoint::name(), points2.clone())]; - let components3 = [(MyPoint::name(), points3.clone())]; + let components1 = [(MyPoint::descriptor(), points1.clone())]; + let components2 = [(MyPoint::descriptor(), points2.clone())]; + let components3 = [(MyPoint::descriptor(), points3.clone())]; let row1 = PendingRow::new(timepoint1.clone(), components1.into_iter().collect()); let row2 = PendingRow::new(timepoint2.clone(), components2.into_iter().collect()); @@ -1321,7 +1338,7 @@ mod tests { ), )]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points1].map(Some)).unwrap(), )]; let expected_chunk = Chunk::from_native_row_ids( @@ -1359,7 +1376,7 @@ mod tests { ), ]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points2, &*points3].map(Some)).unwrap(), )]; let expected_chunk = Chunk::from_native_row_ids( @@ -1395,9 +1412,9 @@ mod tests { MyPoint64::to_arrow2([MyPoint64::new(10.0, 20.0), MyPoint64::new(30.0, 40.0)])?; let points3 = MyPoint::to_arrow2([MyPoint::new(100.0, 200.0), MyPoint::new(300.0, 400.0)])?; - let components1 = [(MyPoint::name(), points1.clone())]; - let components2 = [(MyPoint::name(), points2.clone())]; // same name, different datatype - let components3 = [(MyPoint::name(), points3.clone())]; + let components1 = [(MyPoint::descriptor(), points1.clone())]; + let components2 = [(MyPoint::descriptor(), points2.clone())]; // same name, different datatype + let components3 = [(MyPoint::descriptor(), points3.clone())]; let row1 = PendingRow::new(timepoint1.clone(), components1.into_iter().collect()); let row2 = PendingRow::new(timepoint2.clone(), components2.into_iter().collect()); @@ -1442,7 +1459,7 @@ mod tests { ), )]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points1, &*points3].map(Some)).unwrap(), )]; let expected_chunk = Chunk::from_native_row_ids( @@ -1470,7 +1487,7 @@ mod tests { ), )]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points2].map(Some)).unwrap(), )]; let expected_chunk = Chunk::from_native_row_ids( @@ -1521,10 +1538,10 @@ mod tests { let points4 = MyPoint::to_arrow2([MyPoint::new(1000.0, 2000.0), MyPoint::new(3000.0, 4000.0)])?; - let components1 = [(MyPoint::name(), points1.clone())]; - let components2 = [(MyPoint::name(), points2.clone())]; - let components3 = [(MyPoint::name(), points3.clone())]; - let components4 = [(MyPoint::name(), points4.clone())]; + let components1 = [(MyPoint::descriptor(), points1.clone())]; + let components2 = [(MyPoint::descriptor(), points2.clone())]; + let components3 = [(MyPoint::descriptor(), points3.clone())]; + let components4 = [(MyPoint::descriptor(), points4.clone())]; let row1 = PendingRow::new(timepoint4.clone(), components1.into_iter().collect()); let row2 = PendingRow::new(timepoint1.clone(), components2.into_iter().collect()); @@ -1581,7 +1598,7 @@ mod tests { ), ]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt( &[&*points1, &*points2, &*points3, &*points4].map(Some), ) @@ -1635,10 +1652,10 @@ mod tests { let points4 = MyPoint::to_arrow2([MyPoint::new(1000.0, 2000.0), MyPoint::new(3000.0, 4000.0)])?; - let components1 = [(MyPoint::name(), points1.clone())]; - let components2 = [(MyPoint::name(), points2.clone())]; - let components3 = [(MyPoint::name(), points3.clone())]; - let components4 = [(MyPoint::name(), points4.clone())]; + let components1 = [(MyPoint::descriptor(), points1.clone())]; + let components2 = [(MyPoint::descriptor(), points2.clone())]; + let components3 = [(MyPoint::descriptor(), points3.clone())]; + let components4 = [(MyPoint::descriptor(), points4.clone())]; let row1 = PendingRow::new(timepoint4.clone(), components1.into_iter().collect()); let row2 = PendingRow::new(timepoint1.clone(), components2.into_iter().collect()); @@ -1695,7 +1712,7 @@ mod tests { ), ]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points1, &*points2, &*points3].map(Some)) .unwrap(), )]; @@ -1734,7 +1751,7 @@ mod tests { ), ]; let expected_components = [( - MyPoint::name(), + MyPoint::descriptor(), crate::util::arrays_to_list_array_opt(&[&*points4].map(Some)).unwrap(), )]; let expected_chunk = Chunk::from_native_row_ids( diff --git a/crates/store/re_chunk/src/builder.rs b/crates/store/re_chunk/src/builder.rs index 3dc04b7e81550..48ff0facdad4d 100644 --- a/crates/store/re_chunk/src/builder.rs +++ b/crates/store/re_chunk/src/builder.rs @@ -3,12 +3,12 @@ use arrow2::{ datatypes::DataType as Arrow2Datatype, }; use itertools::Itertools; - use nohash_hasher::IntMap; + use re_log_types::{EntityPath, TimeInt, TimePoint, Timeline}; -use re_types_core::{AsComponents, ComponentBatch, ComponentName}; +use re_types_core::{AsComponents, ComponentBatch, ComponentDescriptor}; -use crate::{Chunk, ChunkId, ChunkResult, RowId, TimeColumn}; +use crate::{chunk::ChunkComponents, Chunk, ChunkId, ChunkResult, RowId, TimeColumn}; // --- @@ -21,7 +21,7 @@ pub struct ChunkBuilder { row_ids: Vec, timelines: IntMap, - components: IntMap>>>, + components: IntMap>>>, } impl Chunk { @@ -61,13 +61,13 @@ impl ChunkBuilder { mut self, row_id: RowId, timepoint: impl Into, - components: impl IntoIterator>)>, + components: impl IntoIterator>)>, ) -> Self { let components = components.into_iter().collect_vec(); // Align all columns by appending null values for rows where we don't have data. - for (component_name, _) in &components { - let arrays = self.components.entry(*component_name).or_default(); + for (component_desc, _) in &components { + let arrays = self.components.entry(component_desc.clone()).or_default(); arrays.extend( std::iter::repeat(None).take(self.row_ids.len().saturating_sub(arrays.len())), ); @@ -105,14 +105,14 @@ impl ChunkBuilder { self, row_id: RowId, timepoint: impl Into, - components: impl IntoIterator)>, + components: impl IntoIterator)>, ) -> Self { self.with_sparse_row( row_id, timepoint, components .into_iter() - .map(|(component_name, array)| (component_name, Some(array))), + .map(|(component_descr, array)| (component_descr, Some(array))), ) } @@ -128,7 +128,9 @@ impl ChunkBuilder { self.with_component_batches( row_id, timepoint, - batches.iter().map(|batch| batch.as_ref()), + batches + .iter() + .map(|batch| batch as &dyn re_types_core::ComponentBatch), ) } @@ -146,7 +148,7 @@ impl ChunkBuilder { component_batch .to_arrow2() .ok() - .map(|array| (component_batch.name(), array)), + .map(|array| (component_batch.descriptor().into_owned(), array)), ) } @@ -165,7 +167,7 @@ impl ChunkBuilder { component_batch .to_arrow2() .ok() - .map(|array| (component_batch.name(), array)) + .map(|array| (component_batch.descriptor().into_owned(), array)) }), ) } @@ -176,16 +178,18 @@ impl ChunkBuilder { self, row_id: RowId, timepoint: impl Into, - component_batches: impl IntoIterator)>, + component_batches: impl IntoIterator< + Item = (ComponentDescriptor, Option<&'a dyn ComponentBatch>), + >, ) -> Self { self.with_sparse_row( row_id, timepoint, component_batches .into_iter() - .map(|(component_name, component_batch)| { + .map(|(component_desc, component_batch)| { ( - component_name, + component_desc, component_batch.and_then(|batch| batch.to_arrow2().ok()), ) }), @@ -225,14 +229,19 @@ impl ChunkBuilder { let components = { re_tracing::profile_scope!("components"); - components - .into_iter() - .filter_map(|(component_name, arrays)| { - let arrays = arrays.iter().map(|array| array.as_deref()).collect_vec(); - crate::util::arrays_to_list_array_opt(&arrays) - .map(|list_array| (component_name, list_array)) - }) - .collect() + let mut per_name = ChunkComponents::default(); + for (component_desc, list_array) in + components + .into_iter() + .filter_map(|(component_desc, arrays)| { + let arrays = arrays.iter().map(|array| array.as_deref()).collect_vec(); + crate::util::arrays_to_list_array_opt(&arrays) + .map(|list_array| (component_desc, list_array)) + }) + { + per_name.insert_descriptor(component_desc, list_array); + } + per_name }; Chunk::from_native_row_ids(id, entity_path, None, &row_ids, timelines, components) @@ -256,7 +265,7 @@ impl ChunkBuilder { #[inline] pub fn build_with_datatypes( self, - datatypes: &IntMap, + datatypes: &IntMap, ) -> ChunkResult { let Self { id, @@ -275,22 +284,28 @@ impl ChunkBuilder { .into_iter() .map(|(timeline, time_column)| (timeline, time_column.build())) .collect(), - components - .into_iter() - .filter_map(|(component_name, arrays)| { - let arrays = arrays.iter().map(|array| array.as_deref()).collect_vec(); - - // If we know the datatype in advance, we're able to keep even fully sparse - // columns around. - if let Some(datatype) = datatypes.get(&component_name) { - crate::util::arrays_to_list_array(datatype.clone(), &arrays) - .map(|list_array| (component_name, list_array)) - } else { - crate::util::arrays_to_list_array_opt(&arrays) - .map(|list_array| (component_name, list_array)) - } - }) - .collect(), + { + let mut per_name = ChunkComponents::default(); + for (component_desc, list_array) in + components + .into_iter() + .filter_map(|(component_desc, arrays)| { + let arrays = arrays.iter().map(|array| array.as_deref()).collect_vec(); + // If we know the datatype in advance, we're able to keep even fully sparse + // columns around. + if let Some(datatype) = datatypes.get(&component_desc) { + crate::util::arrays_to_list_array(datatype.clone(), &arrays) + .map(|list_array| (component_desc, list_array)) + } else { + crate::util::arrays_to_list_array_opt(&arrays) + .map(|list_array| (component_desc, list_array)) + } + }) + { + per_name.insert_descriptor(component_desc, list_array); + } + per_name + }, ) } } diff --git a/crates/store/re_chunk/src/chunk.rs b/crates/store/re_chunk/src/chunk.rs index a1be02f442f9b..58af990a5ba9e 100644 --- a/crates/store/re_chunk/src/chunk.rs +++ b/crates/store/re_chunk/src/chunk.rs @@ -14,7 +14,8 @@ use nohash_hasher::IntMap; use re_log_types::{EntityPath, ResolvedTimeRange, Time, TimeInt, TimePoint, Timeline}; use re_types_core::{ - ComponentName, DeserializationError, Loggable, LoggableBatch, SerializationError, SizeBytes, + ComponentDescriptor, ComponentName, DeserializationError, Loggable, LoggableBatch, + SerializationError, SizeBytes, }; use crate::{ChunkId, RowId}; @@ -49,6 +50,109 @@ pub type ChunkResult = Result; // --- +#[derive(Debug, Clone, Default, PartialEq)] +pub struct ChunkComponents( + // TODO(#6576): support non-list based columns? + // + // NOTE: The extra `ComponentName` layer is needed because it is very common to want to look + // for anything matching a `ComponentName`, without any further tags specified. + pub IntMap>>, +); + +impl ChunkComponents { + /// Like `Self::insert`, but automatically infers the [`ComponentName`] layer. + #[inline] + pub fn insert_descriptor( + &mut self, + component_desc: ComponentDescriptor, + list_array: Arrow2ListArray, + ) { + self.0 + .entry(component_desc.component_name) + .or_default() + .insert(component_desc, list_array); + } + + #[inline] + pub fn get_descriptor( + &self, + component_desc: &ComponentDescriptor, + ) -> Option<&Arrow2ListArray> { + self.get(&component_desc.component_name) + .and_then(|per_desc| per_desc.get(component_desc)) + } + + #[inline] + pub fn get_descriptor_mut( + &mut self, + component_desc: &ComponentDescriptor, + ) -> Option<&mut Arrow2ListArray> { + self.get_mut(&component_desc.component_name) + .and_then(|per_desc| per_desc.get_mut(component_desc)) + } + + #[inline] + pub fn iter_flattened( + &self, + ) -> impl Iterator)> { + self.0.values().flatten() + } + + #[inline] + pub fn into_iter_flattened( + self, + ) -> impl Iterator)> { + self.0.into_values().flatten() + } +} + +impl std::ops::Deref for ChunkComponents { + type Target = IntMap>>; + + #[inline] + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl std::ops::DerefMut for ChunkComponents { + #[inline] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +impl FromIterator<(ComponentDescriptor, Arrow2ListArray)> for ChunkComponents { + #[inline] + fn from_iter)>>( + iter: T, + ) -> Self { + let mut this = Self::default(); + { + for (component_desc, list_array) in iter { + this.entry(component_desc.component_name) + .or_default() + .insert(component_desc, list_array); + } + } + this + } +} + +// TODO(cmc): Kinda disgusting but it makes our lives easier during the interim, as long as we're +// in this weird halfway in-between state where we still have a bunch of things indexed by name only. +impl FromIterator<(ComponentName, Arrow2ListArray)> for ChunkComponents { + #[inline] + fn from_iter)>>(iter: T) -> Self { + iter.into_iter() + .map(|(component_name, list_array)| { + let component_desc = ComponentDescriptor::new(component_name); + (component_desc, list_array) + }) + .collect() + } +} + /// Dense arrow-based storage of N rows of multi-component multi-temporal data for a specific entity. /// /// This is our core datastructure for logging, storing, querying and transporting data around. @@ -88,9 +192,7 @@ pub struct Chunk { /// Each `ListArray` must be the same length as `row_ids`. /// /// Sparse so that we can e.g. log a `Position` at one timestamp but not a `Color`. - // - // TODO(#6576): support non-list based columns? - pub(crate) components: IntMap>, + pub(crate) components: ChunkComponents, } impl PartialEq for Chunk { @@ -115,6 +217,24 @@ impl PartialEq for Chunk { } } +impl Chunk { + /// Returns any list-array that matches the given [`ComponentName`]. + /// + /// This is undefined behavior if there are more than one component with that name. + // + // TODO(cmc): Kinda disgusting but it makes our lives easier during the interim, as long as we're + // in this weird halfway in-between state where we still have a bunch of things indexed by name only. + #[inline] + pub fn get_first_component( + &self, + component_name: &ComponentName, + ) -> Option<&Arrow2ListArray> { + self.components + .get(component_name) + .and_then(|per_desc| per_desc.values().next()) + } +} + impl Chunk { /// Returns a version of us with a new [`ChunkId`]. /// @@ -192,29 +312,33 @@ impl Chunk { ); let components_no_extension: IntMap<_, _> = components - .iter() - .map(|(name, arr)| { - let arr = arrow2::array::ListArray::new( - arr.data_type().to_logical_type().clone(), - arr.offsets().clone(), - arr.values().clone(), - arr.validity().cloned(), - ); - (*name, arr) + .values() + .flat_map(|per_desc| { + per_desc.iter().map(|(component_descr, list_array)| { + let list_array = arrow2::array::ListArray::new( + list_array.data_type().to_logical_type().clone(), + list_array.offsets().clone(), + list_array.values().clone(), + list_array.validity().cloned(), + ); + (component_descr.clone(), list_array) + }) }) .collect(); let other_components_no_extension: IntMap<_, _> = other .components - .iter() - .map(|(name, arr)| { - let arr = arrow2::array::ListArray::new( - arr.data_type().to_logical_type().clone(), - arr.offsets().clone(), - arr.values().clone(), - arr.validity().cloned(), - ); - (*name, arr) + .values() + .flat_map(|per_desc| { + per_desc.iter().map(|(component_descr, list_array)| { + let list_array = arrow2::array::ListArray::new( + list_array.data_type().to_logical_type().clone(), + list_array.offsets().clone(), + list_array.values().clone(), + list_array.validity().cloned(), + ); + (component_descr.clone(), list_array) + }) }) .collect(); @@ -320,7 +444,8 @@ impl Chunk { #[inline] pub fn time_range_per_component( &self, - ) -> IntMap> { + ) -> IntMap>> + { re_tracing::profile_function!(); self.timelines @@ -344,6 +469,7 @@ impl Chunk { // Reminder: component columns are sparse, we must take a look at the validity bitmaps. self.components .values() + .flat_map(|per_desc| per_desc.values()) .map(|list_array| { list_array.validity().map_or_else( || list_array.len() as u64, @@ -407,16 +533,19 @@ impl Chunk { // Raw, potentially duplicated counts (because timestamps aren't necessarily unique). let mut counts_raw = vec![0u64; self.num_rows()]; { - self.components.values().for_each(|list_array| { - if let Some(validity) = list_array.validity() { - validity - .iter() - .enumerate() - .for_each(|(i, is_valid)| counts_raw[i] += is_valid as u64); - } else { - counts_raw.iter_mut().for_each(|count| *count += 1); - } - }); + self.components + .values() + .flat_map(|per_desc| per_desc.values()) + .for_each(|list_array| { + if let Some(validity) = list_array.validity() { + validity + .iter() + .enumerate() + .for_each(|(i, is_valid)| counts_raw[i] += is_valid as u64); + } else { + counts_raw.iter_mut().for_each(|count| *count += 1); + } + }); } let mut counts = Vec::with_capacity(counts_raw.len()); @@ -452,25 +581,26 @@ impl Chunk { // NOTE: This is used on some very hot paths (time panel rendering). - let result_unordered = - self.components - .values() - .fold(HashMap::default(), |acc, list_array| { - if let Some(validity) = list_array.validity() { - time_column.times().zip(validity.iter()).fold( - acc, - |mut acc, (time, is_valid)| { - *acc.entry(time).or_default() += is_valid as u64; - acc - }, - ) - } else { - time_column.times().fold(acc, |mut acc, time| { - *acc.entry(time).or_default() += 1; + let result_unordered = self + .components + .values() + .flat_map(|per_desc| per_desc.values()) + .fold(HashMap::default(), |acc, list_array| { + if let Some(validity) = list_array.validity() { + time_column.times().zip(validity.iter()).fold( + acc, + |mut acc, (time, is_valid)| { + *acc.entry(time).or_default() += is_valid as u64; acc - }) - } - }); + }, + ) + } else { + time_column.times().fold(acc, |mut acc, time| { + *acc.entry(time).or_default() += 1; + acc + }) + } + }); let mut result = result_unordered.into_iter().collect_vec(); result.sort_by_key(|val| val.0); @@ -485,7 +615,7 @@ impl Chunk { #[inline] pub fn num_events_for_component(&self, component_name: ComponentName) -> Option { // Reminder: component columns are sparse, we must check validity bitmap. - self.components.get(&component_name).map(|list_array| { + self.get_first_component(&component_name).map(|list_array| { list_array.validity().map_or_else( || list_array.len() as u64, |validity| validity.len() as u64 - validity.unset_bits() as u64, @@ -501,7 +631,9 @@ impl Chunk { /// This is crucial for indexing and queries to work properly. // // TODO(cmc): This needs to be stored in chunk metadata and transported across IPC. - pub fn row_id_range_per_component(&self) -> IntMap { + pub fn row_id_range_per_component( + &self, + ) -> IntMap> { re_tracing::profile_function!(); let row_ids = self.row_ids().collect_vec(); @@ -509,43 +641,59 @@ impl Chunk { if self.is_sorted() { self.components .iter() - .filter_map(|(component_name, list_array)| { - let mut row_id_min = None; - let mut row_id_max = None; - - for (i, &row_id) in row_ids.iter().enumerate() { - if list_array.is_valid(i) { - row_id_min = Some(row_id); - } - } - for (i, &row_id) in row_ids.iter().enumerate().rev() { - if list_array.is_valid(i) { - row_id_max = Some(row_id); - } - } - - Some((*component_name, (row_id_min?, row_id_max?))) + .map(|(component_name, per_desc)| { + ( + *component_name, + per_desc + .iter() + .filter_map(|(component_desc, list_array)| { + let mut row_id_min = None; + let mut row_id_max = None; + + for (i, &row_id) in row_ids.iter().enumerate() { + if list_array.is_valid(i) { + row_id_min = Some(row_id); + } + } + for (i, &row_id) in row_ids.iter().enumerate().rev() { + if list_array.is_valid(i) { + row_id_max = Some(row_id); + } + } + + Some((component_desc.clone(), (row_id_min?, row_id_max?))) + }) + .collect(), + ) }) .collect() } else { self.components .iter() - .filter_map(|(component_name, list_array)| { - let mut row_id_min = Some(RowId::MAX); - let mut row_id_max = Some(RowId::ZERO); - - for (i, &row_id) in row_ids.iter().enumerate() { - if list_array.is_valid(i) && Some(row_id) > row_id_min { - row_id_min = Some(row_id); - } - } - for (i, &row_id) in row_ids.iter().enumerate().rev() { - if list_array.is_valid(i) && Some(row_id) < row_id_max { - row_id_max = Some(row_id); - } - } - - Some((*component_name, (row_id_min?, row_id_max?))) + .map(|(component_name, per_desc)| { + ( + *component_name, + per_desc + .iter() + .filter_map(|(component_desc, list_array)| { + let mut row_id_min = Some(RowId::MAX); + let mut row_id_max = Some(RowId::ZERO); + + for (i, &row_id) in row_ids.iter().enumerate() { + if list_array.is_valid(i) && Some(row_id) > row_id_min { + row_id_min = Some(row_id); + } + } + for (i, &row_id) in row_ids.iter().enumerate().rev() { + if list_array.is_valid(i) && Some(row_id) < row_id_max { + row_id_max = Some(row_id); + } + } + + Some((component_desc.clone(), (row_id_min?, row_id_max?))) + }) + .collect(), + ) }) .collect() } @@ -594,7 +742,7 @@ impl Chunk { is_sorted: Option, row_ids: Arrow2StructArray, timelines: IntMap, - components: IntMap>, + components: ChunkComponents, ) -> ChunkResult { let mut chunk = Self { id, @@ -628,7 +776,7 @@ impl Chunk { is_sorted: Option, row_ids: &[RowId], timelines: IntMap, - components: IntMap>, + components: ChunkComponents, ) -> ChunkResult { re_tracing::profile_function!(); let row_ids = row_ids @@ -659,10 +807,10 @@ impl Chunk { id: ChunkId, entity_path: EntityPath, timelines: IntMap, - components: IntMap>, + components: ChunkComponents, ) -> ChunkResult { let count = components - .iter() + .iter_flattened() .next() .map_or(0, |(_, list_array)| list_array.len()); @@ -690,7 +838,7 @@ impl Chunk { entity_path: EntityPath, is_sorted: Option, row_ids: Arrow2StructArray, - components: IntMap>, + components: ChunkComponents, ) -> ChunkResult { Self::new( id, @@ -723,10 +871,11 @@ impl Chunk { #[inline] pub fn add_component( &mut self, - component_name: ComponentName, + component_desc: ComponentDescriptor, list_array: Arrow2ListArray, ) -> ChunkResult<()> { - self.components.insert(component_name, list_array); + self.components + .insert_descriptor(component_desc, list_array); self.sanity_check() } @@ -983,7 +1132,7 @@ impl Chunk { &self, component_name: &ComponentName, ) -> impl Iterator + '_ { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -1064,7 +1213,15 @@ impl Chunk { } #[inline] - pub fn components(&self) -> &IntMap> { + pub fn component_descriptors(&self) -> impl Iterator + '_ { + self.components + .values() + .flat_map(|per_desc| per_desc.keys()) + .cloned() + } + + #[inline] + pub fn components(&self) -> &ChunkComponents { &self.components } @@ -1146,46 +1303,57 @@ impl TimeColumn { // TODO(cmc): This needs to be stored in chunk metadata and transported across IPC. pub fn time_range_per_component( &self, - components: &IntMap>, - ) -> IntMap { + components: &ChunkComponents, + ) -> IntMap> { let times = self.times_raw(); components .iter() - .filter_map(|(&component_name, list_array)| { - if let Some(validity) = list_array.validity() { - // _Potentially_ sparse - - if validity.is_empty() { - return None; - } - - let is_dense = validity.unset_bits() == 0; - if is_dense { - return Some((component_name, self.time_range)); - } - - let mut time_min = TimeInt::MAX; - for (i, time) in times.iter().copied().enumerate() { - if validity.get(i).unwrap_or(false) { - time_min = TimeInt::new_temporal(time); - break; - } - } - - let mut time_max = TimeInt::MIN; - for (i, time) in times.iter().copied().enumerate().rev() { - if validity.get(i).unwrap_or(false) { - time_max = TimeInt::new_temporal(time); - break; - } - } - - Some((component_name, ResolvedTimeRange::new(time_min, time_max))) - } else { - // Dense - - Some((component_name, self.time_range)) - } + .map(|(component_name, per_desc)| { + ( + *component_name, + per_desc + .iter() + .filter_map(|(component_desc, list_array)| { + if let Some(validity) = list_array.validity() { + // Potentially sparse + + if validity.is_empty() { + return None; + } + + let is_dense = validity.unset_bits() == 0; + if is_dense { + return Some((component_desc.clone(), self.time_range)); + } + + let mut time_min = TimeInt::MAX; + for (i, time) in times.iter().copied().enumerate() { + if validity.get(i).unwrap_or(false) { + time_min = TimeInt::new_temporal(time); + break; + } + } + + let mut time_max = TimeInt::MIN; + for (i, time) in times.iter().copied().enumerate().rev() { + if validity.get(i).unwrap_or(false) { + time_max = TimeInt::new_temporal(time); + break; + } + } + + Some(( + component_desc.clone(), + ResolvedTimeRange::new(time_min, time_max), + )) + } else { + // Dense + + Some((component_desc.clone(), self.time_range)) + } + }) + .collect(), + ) }) .collect() } @@ -1312,45 +1480,47 @@ impl Chunk { } // Components - for (component_name, list_array) in components { - if !matches!(list_array.data_type(), arrow2::datatypes::DataType::List(_)) { - return Err(ChunkError::Malformed { - reason: format!( - "The outer array in a chunked component batch must be a sparse list, got {:?}", - list_array.data_type(), - ), - }); - } - if let arrow2::datatypes::DataType::List(field) = list_array.data_type() { - if !field.is_nullable { + for (_component_name, per_desc) in components.iter() { + for (component_desc, list_array) in per_desc { + if !matches!(list_array.data_type(), arrow2::datatypes::DataType::List(_)) { return Err(ChunkError::Malformed { reason: format!( - "The outer array in chunked component batch must be a sparse list, got {:?}", + "The outer array in a chunked component batch must be a sparse list, got {:?}", list_array.data_type(), ), }); } - } - if list_array.len() != row_ids.len() { - return Err(ChunkError::Malformed { - reason: format!( - "All component batches in a chunk must have the same number of rows, matching the number of row IDs.\ - Found {} row IDs but {} rows for component batch {component_name}", - row_ids.len(), list_array.len(), - ), - }); - } + if let arrow2::datatypes::DataType::List(field) = list_array.data_type() { + if !field.is_nullable { + return Err(ChunkError::Malformed { + reason: format!( + "The outer array in chunked component batch must be a sparse list, got {:?}", + list_array.data_type(), + ), + }); + } + } + if list_array.len() != row_ids.len() { + return Err(ChunkError::Malformed { + reason: format!( + "All component batches in a chunk must have the same number of rows, matching the number of row IDs.\ + Found {} row IDs but {} rows for component batch {component_desc}", + row_ids.len(), list_array.len(), + ), + }); + } - let validity_is_empty = list_array - .validity() - .map_or(false, |validity| validity.is_empty()); - if !self.is_empty() && validity_is_empty { - return Err(ChunkError::Malformed { - reason: format!( - "All component batches in a chunk must contain at least one non-null entry.\ - Found a completely empty column for {component_name}", - ), - }); + let validity_is_empty = list_array + .validity() + .map_or(false, |validity| validity.is_empty()); + if !self.is_empty() && validity_is_empty { + return Err(ChunkError::Malformed { + reason: format!( + "All component batches in a chunk must contain at least one non-null entry.\ + Found a completely empty column for {component_desc}", + ), + }); + } } } diff --git a/crates/store/re_chunk/src/helpers.rs b/crates/store/re_chunk/src/helpers.rs index c27613137e6d0..1b345c58e5608 100644 --- a/crates/store/re_chunk/src/helpers.rs +++ b/crates/store/re_chunk/src/helpers.rs @@ -21,19 +21,20 @@ impl Chunk { component_name: &ComponentName, row_index: usize, ) -> Option>> { - self.components.get(component_name).and_then(|list_array| { - if list_array.len() > row_index { - list_array - .is_valid(row_index) - .then(|| Ok(list_array.value(row_index))) - } else { - Some(Err(crate::ChunkError::IndexOutOfBounds { - kind: "row".to_owned(), - len: list_array.len(), - index: row_index, - })) - } - }) + self.get_first_component(component_name) + .and_then(|list_array| { + if list_array.len() > row_index { + list_array + .is_valid(row_index) + .then(|| Ok(list_array.value(row_index))) + } else { + Some(Err(crate::ChunkError::IndexOutOfBounds { + kind: "row".to_owned(), + len: list_array.len(), + index: row_index, + })) + } + }) } /// Returns the deserialized data for the specified component. @@ -236,13 +237,21 @@ impl UnitChunkShared { #[inline] pub fn num_instances(&self, component_name: &ComponentName) -> u64 { debug_assert!(self.num_rows() == 1); - self.components.get(component_name).map_or(0, |list_array| { - let array = list_array.value(0); - array.validity().map_or_else( - || array.len(), - |validity| validity.len() - validity.unset_bits(), - ) - }) as u64 + self.components + .values() + .flat_map(|per_desc| per_desc.iter()) + .filter_map(|(descr, list_array)| { + (descr.component_name == *component_name).then_some(list_array) + }) + .map(|list_array| { + let array = list_array.value(0); + array.validity().map_or_else( + || array.len(), + |validity| validity.len() - validity.unset_bits(), + ) + }) + .max() + .unwrap_or(0) as u64 } } @@ -258,8 +267,7 @@ impl UnitChunkShared { component_name: &ComponentName, ) -> Option> { debug_assert!(self.num_rows() == 1); - self.components - .get(component_name) + self.get_first_component(component_name) .and_then(|list_array| list_array.is_valid(0).then(|| list_array.value(0))) } diff --git a/crates/store/re_chunk/src/iter.rs b/crates/store/re_chunk/src/iter.rs index 5f4604aecadd9..6db52257b1695 100644 --- a/crates/store/re_chunk/src/iter.rs +++ b/crates/store/re_chunk/src/iter.rs @@ -62,7 +62,7 @@ impl Chunk { timeline: &Timeline, component_name: &ComponentName, ) -> impl Iterator + '_ { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -128,7 +128,7 @@ impl Chunk { &self, component_name: &ComponentName, ) -> impl Iterator + '_ { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -181,7 +181,7 @@ impl Chunk { &self, component_name: &ComponentName, ) -> impl Iterator + '_ { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -213,7 +213,7 @@ impl Chunk { &self, component_name: &ComponentName, ) -> impl Iterator> + '_ { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -239,7 +239,7 @@ impl Chunk { &self, component_name: &ComponentName, ) -> impl Iterator + '_ { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -284,7 +284,7 @@ impl Chunk { where [T; N]: bytemuck::Pod, { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -346,7 +346,7 @@ impl Chunk { where [T; N]: bytemuck::Pod, { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -428,7 +428,7 @@ impl Chunk { &self, component_name: &ComponentName, ) -> impl Iterator> + '_ { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -479,7 +479,7 @@ impl Chunk { &self, component_name: &ComponentName, ) -> impl Iterator>> + '_ { - let Some(list_array) = self.components.get(component_name) else { + let Some(list_array) = self.get_first_component(component_name) else { return Either::Left(std::iter::empty()); }; @@ -697,7 +697,7 @@ impl Chunk { pub fn iter_component( &self, ) -> ChunkComponentIter + '_> { - let Some(list_array) = self.components.get(&C::name()) else { + let Some(list_array) = self.get_first_component(&C::name()) else { return ChunkComponentIter { values: Arc::new(vec![]), offsets: Either::Left(std::iter::empty()), diff --git a/crates/store/re_chunk/src/latest_at.rs b/crates/store/re_chunk/src/latest_at.rs index c9aa831f60859..0c9278972ca28 100644 --- a/crates/store/re_chunk/src/latest_at.rs +++ b/crates/store/re_chunk/src/latest_at.rs @@ -77,7 +77,7 @@ impl Chunk { re_tracing::profile_function!(format!("{query:?}")); - let Some(component_list_array) = self.components.get(&component_name) else { + let Some(component_list_array) = self.get_first_component(&component_name) else { return self.emptied(); }; diff --git a/crates/store/re_chunk/src/lib.rs b/crates/store/re_chunk/src/lib.rs index 649e5f76a7316..0963ef5f93b26 100644 --- a/crates/store/re_chunk/src/lib.rs +++ b/crates/store/re_chunk/src/lib.rs @@ -24,7 +24,7 @@ mod batcher; mod arrow; pub use self::builder::{ChunkBuilder, TimeColumnBuilder}; -pub use self::chunk::{Chunk, ChunkError, ChunkResult, TimeColumn}; +pub use self::chunk::{Chunk, ChunkComponents, ChunkError, ChunkResult, TimeColumn}; pub use self::helpers::{ChunkShared, UnitChunkShared}; pub use self::id::{ChunkId, RowId}; pub use self::iter::{ChunkComponentIter, ChunkComponentIterItem, ChunkIndicesIter}; @@ -44,7 +44,7 @@ pub use arrow2::array::Array as Arrow2Array; #[doc(no_inline)] pub use re_log_types::{EntityPath, TimeInt, TimePoint, Timeline, TimelineName}; #[doc(no_inline)] -pub use re_types_core::ComponentName; +pub use re_types_core::{ArchetypeFieldName, ArchetypeName, ComponentName}; pub mod external { pub use arrow2; diff --git a/crates/store/re_chunk/src/merge.rs b/crates/store/re_chunk/src/merge.rs index b2f26396520e3..09e347f4221fa 100644 --- a/crates/store/re_chunk/src/merge.rs +++ b/crates/store/re_chunk/src/merge.rs @@ -5,7 +5,7 @@ use arrow2::array::{ use itertools::{izip, Itertools}; use nohash_hasher::IntMap; -use crate::{Chunk, ChunkError, ChunkId, ChunkResult, TimeColumn}; +use crate::{chunk::ChunkComponents, Chunk, ChunkError, ChunkId, ChunkResult, TimeColumn}; // --- @@ -71,14 +71,33 @@ impl Chunk { .collect() }; + let lhs_per_desc: IntMap<_, _> = cl + .components + .values() + .flat_map(|per_desc| { + per_desc + .iter() + .map(|(component_desc, list_array)| (component_desc.clone(), list_array)) + }) + .collect(); + let rhs_per_desc: IntMap<_, _> = cr + .components + .values() + .flat_map(|per_desc| { + per_desc + .iter() + .map(|(component_desc, list_array)| (component_desc.clone(), list_array)) + }) + .collect(); + // First pass: concat right onto left. let mut components: IntMap<_, _> = { re_tracing::profile_scope!("components (r2l)"); - self.components + lhs_per_desc .iter() - .filter_map(|(component_name, lhs_list_array)| { - re_tracing::profile_scope!(format!("{}", component_name.as_str())); - if let Some(rhs_list_array) = rhs.components.get(component_name) { + .filter_map(|(component_desc, &lhs_list_array)| { + re_tracing::profile_scope!(component_desc.to_string()); + if let Some(&rhs_list_array) = rhs_per_desc.get(component_desc) { re_tracing::profile_scope!(format!( "concat (lhs={} rhs={})", re_format::format_uint(lhs_list_array.values().len()), @@ -92,11 +111,11 @@ impl Chunk { .downcast_ref::>()? .clone(); - Some((*component_name, list_array)) + Some((component_desc.clone(), list_array)) } else { re_tracing::profile_scope!("pad"); Some(( - *component_name, + component_desc.clone(), crate::util::pad_list_array_back( lhs_list_array, self.num_rows() + rhs.num_rows(), @@ -110,17 +129,17 @@ impl Chunk { // Second pass: concat left onto right, where necessary. components.extend({ re_tracing::profile_scope!("components (l2r)"); - rhs.components + rhs_per_desc .iter() - .filter_map(|(component_name, rhs_list_array)| { - if components.contains_key(component_name) { + .filter_map(|(component_desc, &rhs_list_array)| { + if components.contains_key(component_desc) { // Already did that one during the first pass. return None; } - re_tracing::profile_scope!(component_name.as_str()); + re_tracing::profile_scope!(component_desc.to_string()); - if let Some(lhs_list_array) = self.components.get(component_name) { + if let Some(&lhs_list_array) = lhs_per_desc.get(component_desc) { re_tracing::profile_scope!(format!( "concat (lhs={} rhs={})", re_format::format_uint(lhs_list_array.values().len()), @@ -134,11 +153,11 @@ impl Chunk { .downcast_ref::>()? .clone(); - Some((*component_name, list_array)) + Some((component_desc.clone(), list_array)) } else { re_tracing::profile_scope!("pad"); Some(( - *component_name, + component_desc.clone(), crate::util::pad_list_array_front( rhs_list_array, self.num_rows() + rhs.num_rows(), @@ -149,6 +168,17 @@ impl Chunk { .collect_vec() }); + let components = { + let mut per_name = ChunkComponents::default(); + for (component_desc, list_array) in components { + per_name + .entry(component_desc.component_name) + .or_default() + .insert(component_desc.clone(), list_array); + } + per_name + }; + let chunk = Self { id: ChunkId::new(), entity_path: cl.entity_path.clone(), @@ -214,9 +244,14 @@ impl Chunk { #[inline] pub fn same_datatypes(&self, rhs: &Self) -> bool { self.components - .iter() - .all(|(component_name, lhs_list_array)| { - if let Some(rhs_list_array) = rhs.components.get(component_name) { + .values() + .flat_map(|per_desc| per_desc.iter()) + .all(|(component_desc, lhs_list_array)| { + if let Some(rhs_list_array) = rhs + .components + .get(&component_desc.component_name) + .and_then(|per_desc| per_desc.get(component_desc)) + { lhs_list_array.data_type() == rhs_list_array.data_type() } else { true @@ -349,45 +384,45 @@ mod tests { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .with_sparse_component_batches( row_id4, timepoint4, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), None), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), None), ], ) .with_sparse_component_batches( row_id5, timepoint5, [ - (MyPoint::name(), Some(points5 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), Some(points5 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .build()?; @@ -419,45 +454,45 @@ mod tests { row_id4, timepoint4, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), None), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), None), ], ) .with_sparse_component_batches( row_id5, timepoint5, [ - (MyPoint::name(), Some(points5 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), Some(points5 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .with_sparse_component_batches( row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build()?; @@ -550,45 +585,45 @@ mod tests { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels1 as _)), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels1 as _)), ], ) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), None), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels3 as _)), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels3 as _)), ], ) .with_sparse_component_batches( row_id4, timepoint4, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), Some(labels4 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), Some(labels4 as _)), ], ) .with_sparse_component_batches( row_id5, timepoint5, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors5 as _)), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors5 as _)), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .build()?; @@ -620,45 +655,45 @@ mod tests { row_id4, timepoint4, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), Some(labels4 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), Some(labels4 as _)), ], ) .with_sparse_component_batches( row_id5, timepoint5, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors5 as _)), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors5 as _)), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .with_sparse_component_batches( row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels1 as _)), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels1 as _)), ], ) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), None), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels3 as _)), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels3 as _)), ], ) .build()?; @@ -776,7 +811,7 @@ mod tests { row_id1, timepoint1, [ - (MyPoint::name(), points32bit), // + (MyPoint::descriptor(), points32bit), // ], ) .build()?; @@ -786,7 +821,7 @@ mod tests { row_id2, timepoint2, [ - (MyPoint::name(), points64bit), // + (MyPoint::descriptor(), points64bit), // ], ) .build()?; diff --git a/crates/store/re_chunk/src/shuffle.rs b/crates/store/re_chunk/src/shuffle.rs index 8600964576da8..3cc07a346f35b 100644 --- a/crates/store/re_chunk/src/shuffle.rs +++ b/crates/store/re_chunk/src/shuffle.rs @@ -259,7 +259,10 @@ impl Chunk { // Reminder: these are all `ListArray`s. re_tracing::profile_scope!("components (offsets & data)"); { - for original in components.values_mut() { + for original in components + .values_mut() + .flat_map(|per_desc| per_desc.values_mut()) + { let sorted_arrays = swaps .iter() .copied() @@ -359,32 +362,32 @@ mod tests { RowId::new(), [(timeline1, 1000), (timeline2, 42)], [ - (MyPoint::name(), Some(&points1 as _)), - (MyColor::name(), Some(&colors1 as _)), + (MyPoint::descriptor(), Some(&points1 as _)), + (MyColor::descriptor(), Some(&colors1 as _)), ], ) .with_sparse_component_batches( RowId::new(), [(timeline1, 1001), (timeline2, 43)], [ - (MyPoint::name(), None), - (MyColor::name(), Some(&colors2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(&colors2 as _)), ], ) .with_sparse_component_batches( RowId::new(), [(timeline1, 1002), (timeline2, 44)], [ - (MyPoint::name(), Some(&points3 as _)), - (MyColor::name(), None), + (MyPoint::descriptor(), Some(&points3 as _)), + (MyColor::descriptor(), None), ], ) .with_sparse_component_batches( RowId::new(), [(timeline1, 1003), (timeline2, 45)], [ - (MyPoint::name(), Some(&points4 as _)), - (MyColor::name(), Some(&colors4 as _)), + (MyPoint::descriptor(), Some(&points4 as _)), + (MyColor::descriptor(), Some(&colors4 as _)), ], ) .build()?; @@ -460,32 +463,32 @@ mod tests { row_id1, [(timeline1, 1000), (timeline2, 45)], [ - (MyPoint::name(), Some(&points1 as _)), - (MyColor::name(), Some(&colors1 as _)), + (MyPoint::descriptor(), Some(&points1 as _)), + (MyColor::descriptor(), Some(&colors1 as _)), ], ) .with_sparse_component_batches( row_id2, [(timeline1, 1001), (timeline2, 44)], [ - (MyPoint::name(), None), - (MyColor::name(), Some(&colors2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(&colors2 as _)), ], ) .with_sparse_component_batches( row_id3, [(timeline1, 1002), (timeline2, 43)], [ - (MyPoint::name(), Some(&points3 as _)), - (MyColor::name(), None), + (MyPoint::descriptor(), Some(&points3 as _)), + (MyColor::descriptor(), None), ], ) .with_sparse_component_batches( row_id4, [(timeline1, 1003), (timeline2, 42)], [ - (MyPoint::name(), Some(&points4 as _)), - (MyColor::name(), Some(&colors4 as _)), + (MyPoint::descriptor(), Some(&points4 as _)), + (MyColor::descriptor(), Some(&colors4 as _)), ], ) .build()?; @@ -553,32 +556,32 @@ mod tests { row_id4, [(timeline1, 1003), (timeline2, 42)], [ - (MyPoint::name(), Some(&points4 as _)), - (MyColor::name(), Some(&colors4 as _)), + (MyPoint::descriptor(), Some(&points4 as _)), + (MyColor::descriptor(), Some(&colors4 as _)), ], ) .with_sparse_component_batches( row_id3, [(timeline1, 1002), (timeline2, 43)], [ - (MyPoint::name(), Some(&points3 as _)), - (MyColor::name(), None), + (MyPoint::descriptor(), Some(&points3 as _)), + (MyColor::descriptor(), None), ], ) .with_sparse_component_batches( row_id2, [(timeline1, 1001), (timeline2, 44)], [ - (MyPoint::name(), None), - (MyColor::name(), Some(&colors2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(&colors2 as _)), ], ) .with_sparse_component_batches( row_id1, [(timeline1, 1000), (timeline2, 45)], [ - (MyPoint::name(), Some(&points1 as _)), - (MyColor::name(), Some(&colors1 as _)), + (MyPoint::descriptor(), Some(&points1 as _)), + (MyColor::descriptor(), Some(&colors1 as _)), ], ) .build()?; diff --git a/crates/store/re_chunk/src/slice.rs b/crates/store/re_chunk/src/slice.rs index 6a3728c3fcefe..00b77a91a34d3 100644 --- a/crates/store/re_chunk/src/slice.rs +++ b/crates/store/re_chunk/src/slice.rs @@ -7,7 +7,7 @@ use itertools::Itertools; use nohash_hasher::IntSet; use re_log_types::Timeline; -use re_types_core::ComponentName; +use re_types_core::{ComponentDescriptor, ComponentName}; use crate::{Chunk, RowId, TimeColumn}; @@ -25,9 +25,12 @@ impl Chunk { pub fn cell( &self, row_id: RowId, - component_name: &ComponentName, + component_desc: &ComponentDescriptor, ) -> Option> { - let list_array = self.components.get(component_name)?; + let list_array = self + .components + .get(&component_desc.component_name) + .and_then(|per_desc| per_desc.get(component_desc))?; if self.is_sorted() { let row_id_128 = row_id.as_u128(); @@ -105,9 +108,12 @@ impl Chunk { .map(|(timeline, time_column)| (*timeline, time_column.row_sliced(index, len))) .collect(), components: components - .iter() - .map(|(component_name, list_array)| { - (*component_name, list_array.clone().sliced(index, len)) + .iter_flattened() + .map(|(component_desc, list_array)| { + ( + component_desc.clone(), + list_array.clone().sliced(index, len), + ) }) .collect(), }; @@ -212,11 +218,13 @@ impl Chunk { is_sorted: *is_sorted, row_ids: row_ids.clone(), timelines: timelines.clone(), - components: components - .get_key_value(&component_name) - .map(|(component_name, list_array)| (*component_name, list_array.clone())) - .into_iter() - .collect(), + components: crate::ChunkComponents( + components + .get_key_value(&component_name) + .map(|(component_name, list_array)| (*component_name, list_array.clone())) + .into_iter() + .collect(), + ), }; #[cfg(debug_assertions)] @@ -298,11 +306,13 @@ impl Chunk { is_sorted: *is_sorted, row_ids: row_ids.clone(), timelines: timelines.clone(), - components: components - .iter() - .filter(|(component_name, _)| component_names.contains(component_name)) - .map(|(component_name, list_array)| (*component_name, list_array.clone())) - .collect(), + components: crate::ChunkComponents( + components + .iter() + .filter(|(component_name, _)| component_names.contains(component_name)) + .map(|(component_name, list_array)| (*component_name, list_array.clone())) + .collect(), + ), }; #[cfg(debug_assertions)] @@ -340,7 +350,7 @@ impl Chunk { return self.clone(); } - let Some(component_list_array) = components.get(&component_name_pov) else { + let Some(component_list_array) = self.get_first_component(&component_name_pov) else { return self.clone(); }; @@ -365,10 +375,10 @@ impl Chunk { .map(|(&timeline, time_column)| (timeline, time_column.filtered(&validity_filter))) .collect(), components: components - .iter() - .map(|(&component_name, list_array)| { + .iter_flattened() + .map(|(component_desc, list_array)| { let filtered = crate::util::filter_array(list_array, &validity_filter); - let filtered = if component_name == component_name_pov { + let filtered = if component_desc.component_name == component_name_pov { // Make sure we fully remove the validity bitmap for the densified // component. // This will allow further operations on this densified chunk to take some @@ -386,7 +396,7 @@ impl Chunk { filtered }; - (component_name, filtered) + (component_desc.clone(), filtered) }) .collect(), }; @@ -446,10 +456,10 @@ impl Chunk { .map(|(&timeline, time_column)| (timeline, time_column.emptied())) .collect(), components: components - .iter() - .map(|(&component_name, list_array)| { + .iter_flattened() + .map(|(component_desc, list_array)| { ( - component_name, + component_desc.clone(), Arrow2ListArray::new_empty(list_array.data_type().clone()), ) }) @@ -544,10 +554,10 @@ impl Chunk { .collect(), components: self .components - .iter() - .map(|(&component_name, list_array)| { + .iter_flattened() + .map(|(component_desc, list_array)| { let filtered = crate::util::take_array(list_array, &indices); - (component_name, filtered) + (component_desc.clone(), filtered) }) .collect(), }; @@ -615,10 +625,10 @@ impl Chunk { .map(|(&timeline, time_column)| (timeline, time_column.filtered(filter))) .collect(), components: components - .iter() - .map(|(&component_name, list_array)| { + .iter_flattened() + .map(|(component_desc, list_array)| { let filtered = crate::util::filter_array(list_array, filter); - (component_name, filtered) + (component_desc.clone(), filtered) }) .collect(), }; @@ -695,10 +705,10 @@ impl Chunk { .map(|(&timeline, time_column)| (timeline, time_column.taken(indices))) .collect(), components: components - .iter() - .map(|(&component_name, list_array)| { + .iter_flattened() + .map(|(component_desc, list_array)| { let taken = crate::util::take_array(list_array, indices); - (component_name, taken) + (component_desc.clone(), taken) }) .collect(), }; @@ -875,7 +885,7 @@ mod tests { example_components::{MyColor, MyLabel, MyPoint}, TimePoint, }; - use re_types_core::Component; + use re_types_core::Component as _; use crate::{Chunk, RowId, Timeline}; @@ -929,45 +939,45 @@ mod tests { row_id2, timepoint4, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), Some(labels4 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), Some(labels4 as _)), ], ) .with_sparse_component_batches( row_id5, timepoint5, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors5 as _)), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors5 as _)), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .with_sparse_component_batches( row_id1, timepoint3, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels1 as _)), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels1 as _)), ], ) .with_sparse_component_batches( row_id4, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), None), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint1, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels3 as _)), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels3 as _)), ], ) .build()?; @@ -975,29 +985,29 @@ mod tests { eprintln!("chunk:\n{chunk}"); let expectations: &[(_, _, Option<&dyn re_types_core::ComponentBatch>)] = &[ - (row_id1, MyPoint::name(), Some(points1 as _)), - (row_id2, MyLabel::name(), Some(labels4 as _)), - (row_id3, MyColor::name(), None), - (row_id4, MyLabel::name(), Some(labels2 as _)), - (row_id5, MyColor::name(), Some(colors5 as _)), + (row_id1, MyPoint::descriptor(), Some(points1 as _)), + (row_id2, MyLabel::descriptor(), Some(labels4 as _)), + (row_id3, MyColor::descriptor(), None), + (row_id4, MyLabel::descriptor(), Some(labels2 as _)), + (row_id5, MyColor::descriptor(), Some(colors5 as _)), ]; assert!(!chunk.is_sorted()); - for (row_id, component_name, expected) in expectations { + for (row_id, component_desc, expected) in expectations { let expected = expected .and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok()); - eprintln!("{component_name} @ {row_id}"); - similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name)); + eprintln!("{component_desc} @ {row_id}"); + similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_desc)); } chunk.sort_if_unsorted(); assert!(chunk.is_sorted()); - for (row_id, component_name, expected) in expectations { + for (row_id, component_desc, expected) in expectations { let expected = expected .and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok()); - eprintln!("{component_name} @ {row_id}"); - similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name)); + eprintln!("{component_desc} @ {row_id}"); + similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_desc)); } Ok(()) @@ -1051,45 +1061,45 @@ mod tests { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels1 as _)), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels1 as _)), ], ) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), None), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels3 as _)), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels3 as _)), ], ) .with_sparse_component_batches( row_id4, timepoint4, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), Some(labels4 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), Some(labels4 as _)), ], ) .with_sparse_component_batches( row_id5, timepoint5, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors5 as _)), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors5 as _)), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .build()?; @@ -1102,20 +1112,20 @@ mod tests { assert_eq!(2, got.num_rows()); let expectations: &[(_, _, Option<&dyn re_types_core::ComponentBatch>)] = &[ - (row_id3, MyPoint::name(), Some(points3 as _)), - (row_id3, MyColor::name(), None), - (row_id3, MyLabel::name(), Some(labels3 as _)), + (row_id3, MyPoint::descriptor(), Some(points3 as _)), + (row_id3, MyColor::descriptor(), None), + (row_id3, MyLabel::descriptor(), Some(labels3 as _)), // - (row_id5, MyPoint::name(), None), - (row_id5, MyColor::name(), Some(colors5 as _)), - (row_id5, MyLabel::name(), Some(labels5 as _)), + (row_id5, MyPoint::descriptor(), None), + (row_id5, MyColor::descriptor(), Some(colors5 as _)), + (row_id5, MyLabel::descriptor(), Some(labels5 as _)), ]; - for (row_id, component_name, expected) in expectations { + for (row_id, component_desc, expected) in expectations { let expected = expected .and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok()); - eprintln!("{component_name} @ {row_id}"); - similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name)); + eprintln!("{component_desc} @ {row_id}"); + similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_desc)); } } @@ -1125,28 +1135,28 @@ mod tests { assert_eq!(5, got.num_rows()); let expectations: &[(_, _, Option<&dyn re_types_core::ComponentBatch>)] = &[ - (row_id1, MyPoint::name(), Some(points1 as _)), - (row_id1, MyColor::name(), None), - (row_id1, MyLabel::name(), Some(labels1 as _)), - (row_id2, MyPoint::name(), None), - (row_id2, MyColor::name(), None), - (row_id2, MyLabel::name(), Some(labels2 as _)), - (row_id3, MyPoint::name(), Some(points3 as _)), - (row_id3, MyColor::name(), None), - (row_id3, MyLabel::name(), Some(labels3 as _)), - (row_id4, MyPoint::name(), None), - (row_id4, MyColor::name(), Some(colors4 as _)), - (row_id4, MyLabel::name(), Some(labels4 as _)), - (row_id5, MyPoint::name(), None), - (row_id5, MyColor::name(), Some(colors5 as _)), - (row_id5, MyLabel::name(), Some(labels5 as _)), + (row_id1, MyPoint::descriptor(), Some(points1 as _)), + (row_id1, MyColor::descriptor(), None), + (row_id1, MyLabel::descriptor(), Some(labels1 as _)), + (row_id2, MyPoint::descriptor(), None), + (row_id2, MyColor::descriptor(), None), + (row_id2, MyLabel::descriptor(), Some(labels2 as _)), + (row_id3, MyPoint::descriptor(), Some(points3 as _)), + (row_id3, MyColor::descriptor(), None), + (row_id3, MyLabel::descriptor(), Some(labels3 as _)), + (row_id4, MyPoint::descriptor(), None), + (row_id4, MyColor::descriptor(), Some(colors4 as _)), + (row_id4, MyLabel::descriptor(), Some(labels4 as _)), + (row_id5, MyPoint::descriptor(), None), + (row_id5, MyColor::descriptor(), Some(colors5 as _)), + (row_id5, MyLabel::descriptor(), Some(labels5 as _)), ]; - for (row_id, component_name, expected) in expectations { + for (row_id, component_desc, expected) in expectations { let expected = expected .and_then(|expected| re_types_core::LoggableBatch::to_arrow2(expected).ok()); - eprintln!("{component_name} @ {row_id}"); - similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_name)); + eprintln!("{component_desc} @ {row_id}"); + similar_asserts::assert_eq!(expected, chunk.cell(*row_id, component_desc)); } } @@ -1182,45 +1192,45 @@ mod tests { row_id1, timepoint_static.clone(), [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels1 as _)), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels1 as _)), ], ) .with_sparse_component_batches( row_id2, timepoint_static.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), None), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint_static.clone(), [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels3 as _)), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels3 as _)), ], ) .with_sparse_component_batches( row_id4, timepoint_static.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), Some(labels4 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), Some(labels4 as _)), ], ) .with_sparse_component_batches( row_id5, timepoint_static.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors5 as _)), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors5 as _)), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .build()?; @@ -1233,9 +1243,9 @@ mod tests { assert_eq!(1, got.num_rows()); let expectations: &[(_, _, Option<&dyn re_types_core::ComponentBatch>)] = &[ - (row_id5, MyPoint::name(), None), - (row_id5, MyColor::name(), Some(colors5 as _)), - (row_id5, MyLabel::name(), Some(labels5 as _)), + (row_id5, MyPoint::descriptor(), None), + (row_id5, MyColor::descriptor(), Some(colors5 as _)), + (row_id5, MyLabel::descriptor(), Some(labels5 as _)), ]; for (row_id, component_name, expected) in expectations { @@ -1252,9 +1262,9 @@ mod tests { assert_eq!(1, got.num_rows()); let expectations: &[(_, _, Option<&dyn re_types_core::ComponentBatch>)] = &[ - (row_id5, MyPoint::name(), None), - (row_id5, MyColor::name(), Some(colors5 as _)), - (row_id5, MyLabel::name(), Some(labels5 as _)), + (row_id5, MyPoint::descriptor(), None), + (row_id5, MyColor::descriptor(), Some(colors5 as _)), + (row_id5, MyLabel::descriptor(), Some(labels5 as _)), ]; for (row_id, component_name, expected) in expectations { @@ -1316,45 +1326,45 @@ mod tests { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels1 as _)), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels1 as _)), ], ) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), None), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels3 as _)), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels3 as _)), ], ) .with_sparse_component_batches( row_id4, timepoint4, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), Some(labels4 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), Some(labels4 as _)), ], ) .with_sparse_component_batches( row_id5, timepoint5, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors5 as _)), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors5 as _)), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .build()?; @@ -1371,17 +1381,17 @@ mod tests { assert_eq!(filter.values_iter().filter(|&b| b).count(), got.num_rows()); let expectations: &[(_, _, Option<&dyn re_types_core::ComponentBatch>)] = &[ - (row_id1, MyPoint::name(), Some(points1 as _)), - (row_id1, MyColor::name(), None), - (row_id1, MyLabel::name(), Some(labels1 as _)), + (row_id1, MyPoint::descriptor(), Some(points1 as _)), + (row_id1, MyColor::descriptor(), None), + (row_id1, MyLabel::descriptor(), Some(labels1 as _)), // - (row_id3, MyPoint::name(), Some(points3 as _)), - (row_id3, MyColor::name(), None), - (row_id3, MyLabel::name(), Some(labels3 as _)), + (row_id3, MyPoint::descriptor(), Some(points3 as _)), + (row_id3, MyColor::descriptor(), None), + (row_id3, MyLabel::descriptor(), Some(labels3 as _)), // - (row_id5, MyPoint::name(), None), - (row_id5, MyColor::name(), Some(colors5 as _)), - (row_id5, MyLabel::name(), Some(labels5 as _)), + (row_id5, MyPoint::descriptor(), None), + (row_id5, MyColor::descriptor(), Some(colors5 as _)), + (row_id5, MyLabel::descriptor(), Some(labels5 as _)), ]; for (row_id, component_name, expected) in expectations { @@ -1461,45 +1471,45 @@ mod tests { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels1 as _)), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels1 as _)), ], ) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), None), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(labels3 as _)), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(labels3 as _)), ], ) .with_sparse_component_batches( row_id4, timepoint4, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors4 as _)), - (MyLabel::name(), Some(labels4 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors4 as _)), + (MyLabel::descriptor(), Some(labels4 as _)), ], ) .with_sparse_component_batches( row_id5, timepoint5, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors5 as _)), - (MyLabel::name(), Some(labels5 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors5 as _)), + (MyLabel::descriptor(), Some(labels5 as _)), ], ) .build()?; @@ -1518,17 +1528,17 @@ mod tests { assert_eq!(indices.len(), got.num_rows()); let expectations: &[(_, _, Option<&dyn re_types_core::ComponentBatch>)] = &[ - (row_id1, MyPoint::name(), Some(points1 as _)), - (row_id1, MyColor::name(), None), - (row_id1, MyLabel::name(), Some(labels1 as _)), + (row_id1, MyPoint::descriptor(), Some(points1 as _)), + (row_id1, MyColor::descriptor(), None), + (row_id1, MyLabel::descriptor(), Some(labels1 as _)), // - (row_id3, MyPoint::name(), Some(points3 as _)), - (row_id3, MyColor::name(), None), - (row_id3, MyLabel::name(), Some(labels3 as _)), + (row_id3, MyPoint::descriptor(), Some(points3 as _)), + (row_id3, MyColor::descriptor(), None), + (row_id3, MyLabel::descriptor(), Some(labels3 as _)), // - (row_id5, MyPoint::name(), None), - (row_id5, MyColor::name(), Some(colors5 as _)), - (row_id5, MyLabel::name(), Some(labels5 as _)), + (row_id5, MyPoint::descriptor(), None), + (row_id5, MyColor::descriptor(), Some(colors5 as _)), + (row_id5, MyLabel::descriptor(), Some(labels5 as _)), ]; for (row_id, component_name, expected) in expectations { diff --git a/crates/store/re_chunk/src/transport.rs b/crates/store/re_chunk/src/transport.rs index b8f2c892d1c17..6e5bbcdcb3f74 100644 --- a/crates/store/re_chunk/src/transport.rs +++ b/crates/store/re_chunk/src/transport.rs @@ -13,9 +13,9 @@ use arrow2::{ use itertools::Itertools; use nohash_hasher::IntMap; use re_log_types::{EntityPath, Timeline}; -use re_types_core::{Component as _, Loggable as _, SizeBytes}; +use re_types_core::{Component as _, ComponentDescriptor, Loggable as _, SizeBytes}; -use crate::{Chunk, ChunkError, ChunkId, ChunkResult, RowId, TimeColumn}; +use crate::{chunk::ChunkComponents, Chunk, ChunkError, ChunkId, ChunkResult, RowId, TimeColumn}; // --- @@ -88,6 +88,12 @@ impl TransportChunk { /// The value used to identify a Rerun data column in field-level [`Arrow2Schema`] metadata. pub const FIELD_METADATA_VALUE_KIND_DATA: &'static str = "data"; + /// The key used to identify the [`crate::ArchetypeName`] in field-level [`Arrow2Schema`] metadata. + pub const FIELD_METADATA_KEY_ARCHETYPE_NAME: &'static str = "rerun.archetype_name"; + + /// The key used to identify the [`crate::ArchetypeFieldName`] in field-level [`Arrow2Schema`] metadata. + pub const FIELD_METADATA_KEY_ARCHETYPE_FIELD_NAME: &'static str = "rerun.archetype_field_name"; + /// The marker used to identify whether a column is sorted in field-level [`Arrow2Schema`] metadata. /// /// The associated value is irrelevant -- if this marker is present, then it is true. @@ -193,6 +199,48 @@ impl TransportChunk { ] .into() } + + #[inline] + pub fn field_metadata_component_descriptor( + component_desc: &ComponentDescriptor, + ) -> Arrow2Metadata { + component_desc + .archetype_name + .iter() + .copied() + .map(|archetype_name| { + ( + Self::FIELD_METADATA_KEY_ARCHETYPE_NAME.to_owned(), + archetype_name.to_string(), + ) + }) + .chain(component_desc.archetype_field_name.iter().copied().map( + |archetype_field_name| { + ( + Self::FIELD_METADATA_KEY_ARCHETYPE_FIELD_NAME.to_owned(), + archetype_field_name.to_string(), + ) + }, + )) + .collect() + } + + #[inline] + pub fn component_descriptor_from_field(field: &ArrowField) -> ComponentDescriptor { + ComponentDescriptor { + archetype_name: field + .metadata + .get(Self::FIELD_METADATA_KEY_ARCHETYPE_NAME) + .cloned() + .map(Into::into), + component_name: field.name.clone().into(), + archetype_field_name: field + .metadata + .get(Self::FIELD_METADATA_KEY_ARCHETYPE_FIELD_NAME) + .cloned() + .map(Into::into), + } + } } impl TransportChunk { @@ -383,7 +431,7 @@ impl Chunk { schema.fields.push( ArrowField::new( - RowId::name().to_string(), + RowId::descriptor().to_string(), row_ids.data_type().clone(), false, ) @@ -438,13 +486,23 @@ impl Chunk { re_tracing::profile_scope!("components"); let mut components = components - .iter() - .map(|(component_name, data)| { - let field = - ArrowField::new(component_name.to_string(), data.data_type().clone(), true) - .with_metadata(TransportChunk::field_metadata_data_column()); + .values() + .flat_map(|per_desc| per_desc.iter()) + .map(|(component_desc, list_array)| { + let field = ArrowField::new( + component_desc.component_name.to_string(), + list_array.data_type().clone(), + true, + ) + .with_metadata({ + let mut metadata = TransportChunk::field_metadata_data_column(); + metadata.extend(TransportChunk::field_metadata_component_descriptor( + component_desc, + )); + metadata + }); - let data = data.clone().boxed(); + let data = list_array.clone().boxed(); (field, data) }) @@ -486,7 +544,8 @@ impl Chunk { re_tracing::profile_scope!("row ids"); let Some(row_ids) = transport.controls().find_map(|(field, column)| { - (field.name == RowId::name().as_str()).then_some(column) + // TODO(cmc): disgusting, but good enough for now. + (field.name == RowId::descriptor().component_name.as_str()).then_some(column) }) else { return Err(ChunkError::Malformed { reason: format!("missing row_id column ({:?})", transport.schema), @@ -575,7 +634,7 @@ impl Chunk { // Components let components = { - let mut components = IntMap::default(); + let mut components = ChunkComponents::default(); for (field, column) in transport.components() { let column = column @@ -588,11 +647,12 @@ impl Chunk { ), })?; + let component_desc = TransportChunk::component_descriptor_from_field(field); + if components - .insert( - field.name.clone().into(), - column.clone(), /* refcount */ - ) + .entry(component_desc.component_name) + .or_default() + .insert(component_desc, column.clone() /* refcount */) .is_some() { return Err(ChunkError::Malformed { @@ -703,7 +763,7 @@ mod tests { let colors4 = None; let components = [ - (MyPoint::name(), { + (MyPoint::descriptor(), { let list_array = crate::util::arrays_to_list_array_opt(&[ Some(&*points1), points2, @@ -714,7 +774,7 @@ mod tests { assert_eq!(4, list_array.len()); list_array }), - (MyPoint::name(), { + (MyPoint::descriptor(), { let list_array = crate::util::arrays_to_list_array_opt(&[ Some(&*colors1), Some(&*colors2), diff --git a/crates/store/re_chunk/tests/latest_at.rs b/crates/store/re_chunk/tests/latest_at.rs index 5525a6fd81165..3cdb110d60b3a 100644 --- a/crates/store/re_chunk/tests/latest_at.rs +++ b/crates/store/re_chunk/tests/latest_at.rs @@ -1,19 +1,19 @@ use arrow2::datatypes::DataType as Arrow2Datatype; use nohash_hasher::IntMap; -use re_chunk::{Chunk, ComponentName, LatestAtQuery, RowId, TimePoint, Timeline}; +use re_chunk::{Chunk, LatestAtQuery, RowId, TimePoint, Timeline}; use re_log_types::example_components::{MyColor, MyLabel, MyPoint}; -use re_types_core::{Component, Loggable}; +use re_types_core::{Component as _, ComponentDescriptor, Loggable as _}; // --- const ENTITY_PATH: &str = "my/entity"; -fn datatypes() -> IntMap { +fn datatypes() -> IntMap { [ - (MyPoint::name(), MyPoint::arrow2_datatype()), - (MyColor::name(), MyColor::arrow2_datatype()), - (MyLabel::name(), MyLabel::arrow2_datatype()), + (MyPoint::descriptor(), MyPoint::arrow2_datatype()), + (MyColor::descriptor(), MyColor::arrow2_datatype()), + (MyLabel::descriptor(), MyLabel::arrow2_datatype()), ] .into_iter() .collect() @@ -67,19 +67,19 @@ fn temporal_sorted() -> anyhow::Result<()> { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = chunk.emptied(); - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = chunk.emptied(); - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } { let query = LatestAtQuery::new(Timeline::new_sequence("frame"), 4); @@ -89,39 +89,39 @@ fn temporal_sorted() -> anyhow::Result<()> { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } { let query = LatestAtQuery::new(Timeline::new_sequence("frame"), 6); @@ -131,39 +131,39 @@ fn temporal_sorted() -> anyhow::Result<()> { row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } Ok(()) @@ -217,19 +217,19 @@ fn temporal_unsorted() -> anyhow::Result<()> { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = chunk.emptied(); - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = chunk.emptied(); - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } { let query = LatestAtQuery::new(Timeline::log_time(), 1050); @@ -239,39 +239,39 @@ fn temporal_unsorted() -> anyhow::Result<()> { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } { let query = LatestAtQuery::new(Timeline::log_time(), 1100); @@ -281,39 +281,39 @@ fn temporal_unsorted() -> anyhow::Result<()> { row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } Ok(()) @@ -356,39 +356,39 @@ fn static_sorted() -> anyhow::Result<()> { row_id3, timepoint.clone(), [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } Ok(()) @@ -431,39 +431,39 @@ fn static_unsorted() -> anyhow::Result<()> { row_id3, timepoint.clone(), [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } Ok(()) @@ -472,15 +472,15 @@ fn static_unsorted() -> anyhow::Result<()> { // --- fn query_and_compare( - (component_name, query): (ComponentName, &LatestAtQuery), + (component_desc, query): (ComponentDescriptor, &LatestAtQuery), chunk: &Chunk, expected: &Chunk, ) { re_log::setup_logging(); - let results = chunk.latest_at(query, component_name); + let results = chunk.latest_at(query, component_desc.component_name); - eprintln!("Query: {component_name} @ {query:?}"); + eprintln!("Query: {component_desc} @ {query:?}"); eprintln!("Data:\n{chunk}"); eprintln!("Expected:\n{expected}"); eprintln!("Results:\n{results}"); diff --git a/crates/store/re_chunk/tests/range.rs b/crates/store/re_chunk/tests/range.rs index 996a27d473c21..372783024a94c 100644 --- a/crates/store/re_chunk/tests/range.rs +++ b/crates/store/re_chunk/tests/range.rs @@ -1,22 +1,22 @@ use arrow2::datatypes::DataType as Arrow2Datatype; use nohash_hasher::IntMap; -use re_chunk::{Chunk, ComponentName, RangeQuery, RowId, TimePoint, Timeline}; +use re_chunk::{Chunk, RangeQuery, RowId, TimePoint, Timeline}; use re_log_types::{ example_components::{MyColor, MyLabel, MyPoint}, ResolvedTimeRange, }; -use re_types_core::{Component as _, Loggable as _}; +use re_types_core::{Component as _, ComponentDescriptor, Loggable as _}; // --- const ENTITY_PATH: &str = "my/entity"; -fn datatypes() -> IntMap { +fn datatypes() -> IntMap { [ - (MyPoint::name(), MyPoint::arrow2_datatype()), - (MyColor::name(), MyColor::arrow2_datatype()), - (MyLabel::name(), MyLabel::arrow2_datatype()), + (MyPoint::descriptor(), MyPoint::arrow2_datatype()), + (MyColor::descriptor(), MyColor::arrow2_datatype()), + (MyLabel::descriptor(), MyLabel::arrow2_datatype()), ] .into_iter() .collect() @@ -73,48 +73,48 @@ fn temporal_sorted() -> anyhow::Result<()> { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } { @@ -122,33 +122,33 @@ fn temporal_sorted() -> anyhow::Result<()> { RangeQuery::with_extras(Timeline::log_time(), ResolvedTimeRange::new(1020, 1050)); let expected = chunk.emptied(); - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } Ok(()) @@ -202,48 +202,48 @@ fn temporal_unsorted() -> anyhow::Result<()> { row_id1, timepoint1, [ - (MyPoint::name(), Some(points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .with_sparse_component_batches( row_id3, timepoint3, [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } { @@ -251,33 +251,33 @@ fn temporal_unsorted() -> anyhow::Result<()> { RangeQuery::with_extras(Timeline::log_time(), ResolvedTimeRange::new(1020, 1050)); let expected = chunk.emptied(); - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint2, [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } Ok(()) @@ -326,39 +326,39 @@ fn static_sorted() -> anyhow::Result<()> { row_id3, timepoint.clone(), [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } Ok(()) @@ -407,39 +407,39 @@ fn static_unsorted() -> anyhow::Result<()> { row_id3, timepoint.clone(), [ - (MyPoint::name(), Some(points3 as _)), - (MyColor::name(), None), - (MyLabel::name(), None), + (MyPoint::descriptor(), Some(points3 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), None), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyPoint::name(), &query), &chunk, &expected); + query_and_compare((MyPoint::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyColor::name(), &query), &chunk, &expected); + query_and_compare((MyColor::descriptor(), &query), &chunk, &expected); let expected = Chunk::builder_with_id(chunk.id(), ENTITY_PATH.into()) .with_sparse_component_batches( row_id2, timepoint.clone(), [ - (MyPoint::name(), None), - (MyColor::name(), Some(colors2 as _)), - (MyLabel::name(), Some(labels2 as _)), + (MyPoint::descriptor(), None), + (MyColor::descriptor(), Some(colors2 as _)), + (MyLabel::descriptor(), Some(labels2 as _)), ], ) .build_with_datatypes(&datatypes())?; - query_and_compare((MyLabel::name(), &query), &chunk, &expected); + query_and_compare((MyLabel::descriptor(), &query), &chunk, &expected); } Ok(()) @@ -448,15 +448,15 @@ fn static_unsorted() -> anyhow::Result<()> { // --- fn query_and_compare( - (component_name, query): (ComponentName, &RangeQuery), + (component_desc, query): (ComponentDescriptor, &RangeQuery), chunk: &Chunk, expected: &Chunk, ) { re_log::setup_logging(); - let results = chunk.range(query, component_name); + let results = chunk.range(query, component_desc.component_name); - eprintln!("Query: {component_name} @ {query:?}"); + eprintln!("Query: {component_desc} @ {query:?}"); eprintln!("Data:\n{chunk}"); eprintln!("Expected:\n{expected}"); eprintln!("Results:\n{results}"); diff --git a/crates/store/re_chunk_store/src/dataframe.rs b/crates/store/re_chunk_store/src/dataframe.rs index eda6c6190153d..d84ce2dc86f8d 100644 --- a/crates/store/re_chunk_store/src/dataframe.rs +++ b/crates/store/re_chunk_store/src/dataframe.rs @@ -10,7 +10,9 @@ use itertools::Itertools; use re_chunk::TimelineName; use re_log_types::{ComponentPath, EntityPath, ResolvedTimeRange, TimeInt, Timeline}; -use re_types_core::{ArchetypeName, ComponentName, ComponentNameSet}; +use re_types_core::{ + ArchetypeFieldName, ArchetypeName, ComponentDescriptor, ComponentName, ComponentNameSet, +}; use crate::{ChunkStore, ColumnMetadata}; @@ -135,7 +137,7 @@ pub struct ComponentColumnDescriptor { /// `None` if the data wasn't logged through an archetype. /// /// Example: `positions`. - pub archetype_field_name: Option, + pub archetype_field_name: Option, /// Semantic name associated with this data. /// @@ -211,24 +213,14 @@ impl std::fmt::Display for ComponentColumnDescriptor { is_semantically_empty: _, } = self; - let s = match (archetype_name, component_name, archetype_field_name) { - (None, component_name, None) => component_name.to_string(), - (Some(archetype_name), component_name, None) => format!( - "{entity_path}@{}::{}", - archetype_name.short_name(), - component_name.short_name(), - ), - (None, component_name, Some(archetype_field_name)) => format!( - "{entity_path}@{}#{archetype_field_name}", - component_name.short_name(), - ), - (Some(archetype_name), component_name, Some(archetype_field_name)) => format!( - "{entity_path}@{}::{}#{archetype_field_name}", - archetype_name.short_name(), - component_name.short_name(), - ), + let descriptor = ComponentDescriptor { + archetype_name: *archetype_name, + archetype_field_name: *archetype_field_name, + component_name: *component_name, }; + let s = format!("{entity_path}@{}", descriptor.short_name()); + if *is_static { f.write_fmt(format_args!("|{s}|")) } else { @@ -237,6 +229,28 @@ impl std::fmt::Display for ComponentColumnDescriptor { } } +impl From for re_types_core::ComponentDescriptor { + #[inline] + fn from(descr: ComponentColumnDescriptor) -> Self { + Self { + archetype_name: descr.archetype_name, + archetype_field_name: descr.archetype_field_name, + component_name: descr.component_name, + } + } +} + +impl From<&ComponentColumnDescriptor> for re_types_core::ComponentDescriptor { + #[inline] + fn from(descr: &ComponentColumnDescriptor) -> Self { + Self { + archetype_name: descr.archetype_name, + archetype_field_name: descr.archetype_field_name, + component_name: descr.component_name, + } + } +} + impl ComponentColumnDescriptor { pub fn component_path(&self) -> ComponentPath { ComponentPath { @@ -282,7 +296,7 @@ impl ComponentColumnDescriptor { }), archetype_field_name .as_ref() - .map(|name| ("sorbet.logical_type".to_owned(), name.to_owned())), + .map(|name| ("sorbet.logical_type".to_owned(), name.to_string())), ] .into_iter() .flatten() @@ -296,12 +310,19 @@ impl ComponentColumnDescriptor { #[inline] pub fn to_arrow_field(&self) -> Arrow2Field { + let entity_path = &self.entity_path; + let descriptor = ComponentDescriptor { + archetype_name: self.archetype_name, + archetype_field_name: self.archetype_field_name, + component_name: self.component_name, + }; + Arrow2Field::new( - format!( - "{}:{}", - self.entity_path, - self.component_name.short_name().to_owned() - ), + // NOTE: Uncomment this to expose fully-qualified names in the Dataframe APIs! + // I'm not doing that right now, to avoid breaking changes (and we need to talk about + // what the syntax for these fully-qualified paths need to look like first). + format!("{}:{}", entity_path, descriptor.component_name.short_name()), + // format!("{entity_path}@{}", descriptor.short_name()), self.returned_datatype(), true, /* nullable */ ) @@ -648,18 +669,19 @@ impl ChunkStore { let mut components = self .per_column_metadata .iter() - .flat_map(|(entity_path, per_component)| { - per_component - .keys() - .map(move |component_name| (entity_path, component_name)) + .flat_map(|(entity_path, per_name)| { + per_name.values().flat_map(move |per_descr| { + per_descr.keys().map(move |descr| (entity_path, descr)) + }) }) - .filter_map(|(entity_path, component_name)| { - let metadata = self.lookup_column_metadata(entity_path, component_name)?; - let datatype = self.lookup_datatype(component_name)?; + .filter_map(|(entity_path, component_descr)| { + let metadata = + self.lookup_column_metadata(entity_path, &component_descr.component_name)?; + let datatype = self.lookup_datatype(&component_descr.component_name)?; - Some(((entity_path, component_name), (metadata, datatype))) + Some(((entity_path, component_descr), (metadata, datatype))) }) - .map(|((entity_path, component_name), (metadata, datatype))| { + .map(|((entity_path, component_descr), (metadata, datatype))| { let ColumnMetadata { is_static, is_indicator, @@ -667,13 +689,11 @@ impl ChunkStore { is_semantically_empty, } = metadata; - // TODO(#6889): Fill `archetype_name`/`archetype_field_name` (or whatever their - // final name ends up being) once we generate tags. ComponentColumnDescriptor { entity_path: entity_path.clone(), - archetype_name: None, - archetype_field_name: None, - component_name: *component_name, + archetype_name: component_descr.archetype_name, + archetype_field_name: component_descr.archetype_field_name, + component_name: component_descr.component_name, // NOTE: The data is always a at least a list, whether it's latest-at or range. // It might be wrapped further in e.g. a dict, but at the very least // it's a list. @@ -730,27 +750,27 @@ impl ChunkStore { // Happy path if this string is a valid component // TODO(#7699) This currently interns every string ever queried which could be wasteful, especially // in long-running servers. In practice this probably doesn't matter. - let direct_component = ComponentName::from(selector.component_name.clone()); + let selected_component_name = ComponentName::from(selector.component_name.clone()); - let component_name = if self.all_components().contains(&direct_component) { - direct_component - } else { - self.all_components_for_entity(&selector.entity_path) - // First just check on the entity since this is the most likely place to find it. - .and_then(|components| { - components - .into_iter() - .find(|component_name| component_name.matches(&selector.component_name)) - }) - // Fall back on matching any component in the store - .or_else(|| { - self.all_components() - .into_iter() - .find(|component_name| component_name.matches(&selector.component_name)) + let column_info = self + .per_column_metadata + .get(&selector.entity_path) + .and_then(|per_name| { + per_name.get(&selected_component_name).or_else(|| { + per_name.iter().find_map(|(component_name, per_descr)| { + component_name + .matches(&selector.component_name) + .then_some(per_descr) + }) }) - // Finally fall back on the direct component name - .unwrap_or(direct_component) - }; + }) + .and_then(|per_descr| per_descr.iter().next()); + + let component_descr = column_info.map(|(descr, _metadata)| descr); + let _column_metadata = column_info.map(|(_descr, metadata)| metadata).cloned(); + + let component_name = + component_descr.map_or(selected_component_name, |descr| descr.component_name); let ColumnMetadata { is_static, @@ -773,8 +793,8 @@ impl ChunkStore { ComponentColumnDescriptor { entity_path: selector.entity_path.clone(), - archetype_name: None, - archetype_field_name: None, + archetype_name: component_descr.and_then(|descr| descr.archetype_name), + archetype_field_name: component_descr.and_then(|descr| descr.archetype_field_name), component_name, store_datatype: ArrowListArray::::default_datatype(datatype.clone()), is_static, diff --git a/crates/store/re_chunk_store/src/events.rs b/crates/store/re_chunk_store/src/events.rs index ac9efa8ce69f7..8dc54955a27f2 100644 --- a/crates/store/re_chunk_store/src/events.rs +++ b/crates/store/re_chunk_store/src/events.rs @@ -263,9 +263,12 @@ mod tests { .entry(event.chunk.entity_path().clone()) .or_default() += delta_chunks; - for (component_name, list_array) in event.chunk.components() { + for (component_desc, list_array) in event.chunk.components().iter_flattened() { let delta = event.delta() * list_array.iter().flatten().count() as i64; - *self.component_names.entry(*component_name).or_default() += delta; + *self + .component_names + .entry(component_desc.component_name) + .or_default() += delta; } if event.is_static() { diff --git a/crates/store/re_chunk_store/src/gc.rs b/crates/store/re_chunk_store/src/gc.rs index 714199f7896f8..f6f7612cb27fa 100644 --- a/crates/store/re_chunk_store/src/gc.rs +++ b/crates/store/re_chunk_store/src/gc.rs @@ -472,18 +472,20 @@ impl ChunkStore { for (timeline, time_range_per_component) in chunk.time_range_per_component() { let chunk_ids_to_be_removed = chunk_ids_to_be_removed.entry(timeline).or_default(); - for (component_name, time_range) in time_range_per_component { - let chunk_ids_to_be_removed = - chunk_ids_to_be_removed.entry(component_name).or_default(); - - chunk_ids_to_be_removed - .entry(time_range.min()) - .or_default() - .push(chunk.id()); - chunk_ids_to_be_removed - .entry(time_range.max()) - .or_default() - .push(chunk.id()); + for (component_name, per_desc) in time_range_per_component { + for (_component_desc, time_range) in per_desc { + let chunk_ids_to_be_removed = + chunk_ids_to_be_removed.entry(component_name).or_default(); + + chunk_ids_to_be_removed + .entry(time_range.min()) + .or_default() + .push(chunk.id()); + chunk_ids_to_be_removed + .entry(time_range.max()) + .or_default() + .push(chunk.id()); + } } } } diff --git a/crates/store/re_chunk_store/src/query.rs b/crates/store/re_chunk_store/src/query.rs index c8d479ff51f69..76056b17f4de0 100644 --- a/crates/store/re_chunk_store/src/query.rs +++ b/crates/store/re_chunk_store/src/query.rs @@ -746,6 +746,7 @@ impl ChunkStore { time_column .time_range_per_component(chunk.components()) .get(&component_name) + .and_then(|per_desc| per_desc.values().next()) .map_or(false, |time_range| time_range.intersects(query.range())) }) }) diff --git a/crates/store/re_chunk_store/src/store.rs b/crates/store/re_chunk_store/src/store.rs index 705dca3f12e26..454e3fb5c3ab6 100644 --- a/crates/store/re_chunk_store/src/store.rs +++ b/crates/store/re_chunk_store/src/store.rs @@ -7,7 +7,7 @@ use nohash_hasher::IntMap; use re_chunk::{Chunk, ChunkId, RowId, TransportChunk}; use re_log_types::{EntityPath, StoreId, StoreInfo, TimeInt, Timeline}; -use re_types_core::ComponentName; +use re_types_core::{ComponentDescriptor, ComponentName}; use crate::{ChunkStoreChunkStats, ChunkStoreError, ChunkStoreResult}; @@ -258,16 +258,17 @@ pub struct ChunkIdSetPerTime { pub(crate) per_end_time: BTreeMap, } -pub type ChunkIdSetPerTimePerComponent = IntMap; +pub type ChunkIdSetPerTimePerComponentName = IntMap; -pub type ChunkIdSetPerTimePerComponentPerTimeline = IntMap; +pub type ChunkIdSetPerTimePerComponentNamePerTimeline = + IntMap; -pub type ChunkIdSetPerTimePerComponentPerTimelinePerEntity = - IntMap; +pub type ChunkIdSetPerTimePerComponentNamePerTimelinePerEntity = + IntMap; -pub type ChunkIdPerComponent = IntMap; +pub type ChunkIdPerComponentName = IntMap; -pub type ChunkIdPerComponentPerEntity = IntMap; +pub type ChunkIdPerComponentNamePerEntity = IntMap; pub type ChunkIdSetPerTimePerTimeline = IntMap; @@ -408,7 +409,8 @@ pub struct ChunkStore { // different datatype for a given component. pub(crate) type_registry: IntMap, - pub(crate) per_column_metadata: IntMap>, + pub(crate) per_column_metadata: + IntMap>>, pub(crate) chunks_per_chunk_id: BTreeMap>, @@ -426,7 +428,7 @@ pub struct ChunkStore { /// * [`Self::temporal_chunk_ids_per_entity`]. /// * [`Self::static_chunk_ids_per_entity`]. pub(crate) temporal_chunk_ids_per_entity_per_component: - ChunkIdSetPerTimePerComponentPerTimelinePerEntity, + ChunkIdSetPerTimePerComponentNamePerTimelinePerEntity, /// All temporal [`ChunkId`]s for all entities on all timelines, without the [`ComponentName`] index. /// @@ -445,7 +447,7 @@ pub struct ChunkStore { /// Static data unconditionally shadows temporal data at query time. /// /// Existing temporal will not be removed. Events won't be fired. - pub(crate) static_chunk_ids_per_entity: ChunkIdPerComponentPerEntity, + pub(crate) static_chunk_ids_per_entity: ChunkIdPerComponentNamePerEntity, /// Accumulated size statitistics for all static [`Chunk`]s currently present in the store. /// @@ -647,7 +649,12 @@ impl ChunkStore { } = self .per_column_metadata .get(entity_path) - .and_then(|per_component| per_component.get(component_name))?; + .and_then(|per_name| per_name.get(component_name)) + .and_then(|per_component| { + per_component.iter().find_map(|(descr, metadata)| { + (descr.component_name == *component_name).then_some(metadata) + }) + })?; let is_static = self .static_chunk_ids_per_entity @@ -659,8 +666,9 @@ impl ChunkStore { let is_indicator = component_name.is_indicator_component(); use re_types_core::Archetype as _; - let is_tombstone = - re_types_core::archetypes::Clear::all_components().contains(component_name); + let is_tombstone = re_types_core::archetypes::Clear::all_components() + .iter() + .any(|descr| descr.component_name == *component_name); Some(ColumnMetadata { is_static, @@ -701,7 +709,60 @@ impl ChunkStore { // TODO(cmc): offload the decoding to a background thread. for res in &mut decoder { - let msg = res.with_context(|| format!("couldn't decode message {path_to_rrd:?} "))?; + let msg = res.with_context(|| format!("couldn't decode message {path_to_rrd:?}"))?; + match msg { + re_log_types::LogMsg::SetStoreInfo(info) => { + let store = stores.entry(info.info.store_id.clone()).or_insert_with(|| { + Self::new(info.info.store_id.clone(), store_config.clone()) + }); + + store.set_info(info.info); + } + + re_log_types::LogMsg::ArrowMsg(store_id, msg) => { + let Some(store) = stores.get_mut(&store_id) else { + anyhow::bail!("unknown store ID: {store_id}"); + }; + + let transport = TransportChunk { + schema: msg.schema.clone(), + data: msg.chunk.clone(), + }; + + let chunk = Chunk::from_transport(&transport) + .with_context(|| format!("couldn't decode chunk {path_to_rrd:?}"))?; + + store + .insert_chunk(&Arc::new(chunk)) + .with_context(|| format!("couldn't insert chunk {path_to_rrd:?}"))?; + } + + re_log_types::LogMsg::BlueprintActivationCommand(_) => {} + } + } + + Ok(stores) + } + + /// Instantiate a new `ChunkStore` with the given [`ChunkStoreConfig`]. + /// + /// The stores will be prefilled with the data in the given `log_msgs`. + /// + /// See also: + /// * [`ChunkStore::new`] + pub fn from_log_msgs( + store_config: &ChunkStoreConfig, + log_msgs: impl IntoIterator, + ) -> anyhow::Result> { + re_tracing::profile_function!(); + + use anyhow::Context as _; + + let mut stores = BTreeMap::new(); + + // TODO(cmc): offload the decoding to a background thread. + let log_msgs = log_msgs.into_iter(); + for msg in log_msgs { match msg { re_log_types::LogMsg::SetStoreInfo(info) => { let store = stores.entry(info.info.store_id.clone()).or_insert_with(|| { @@ -722,11 +783,11 @@ impl ChunkStore { }; let chunk = Chunk::from_transport(&transport) - .with_context(|| format!("couldn't decode chunk {path_to_rrd:?} "))?; + .with_context(|| "couldn't decode chunk".to_owned())?; store .insert_chunk(&Arc::new(chunk)) - .with_context(|| format!("couldn't insert chunk {path_to_rrd:?} "))?; + .with_context(|| "couldn't insert chunk".to_owned())?; } re_log_types::LogMsg::BlueprintActivationCommand(_) => {} diff --git a/crates/store/re_chunk_store/src/writes.rs b/crates/store/re_chunk_store/src/writes.rs index 26c439cd475bf..d3dd66f477762 100644 --- a/crates/store/re_chunk_store/src/writes.rs +++ b/crates/store/re_chunk_store/src/writes.rs @@ -37,6 +37,14 @@ impl ChunkStore { return Ok(Vec::new()); } + #[cfg(debug_assertions)] + for (component_name, per_desc) in chunk.components().iter() { + assert!( + per_desc.len() <= 1, + "Insert Chunk with multiple values for component named `{component_name}`: this is currently UB", + ); + } + if !chunk.is_sorted() { return Err(ChunkStoreError::UnsortedChunk); } @@ -59,7 +67,7 @@ impl ChunkStore { let mut overwritten_chunk_ids = HashMap::default(); - for (&component_name, list_array) in chunk.components() { + for (component_desc, list_array) in chunk.components().iter_flattened() { let is_empty = list_array .validity() .map_or(false, |validity| validity.is_empty()); @@ -68,7 +76,9 @@ impl ChunkStore { } let Some((_row_id_min_for_component, row_id_max_for_component)) = - row_id_range_per_component.get(&component_name) + row_id_range_per_component + .get(&component_desc.component_name) + .and_then(|per_desc| per_desc.get(component_desc)) else { continue; }; @@ -76,7 +86,7 @@ impl ChunkStore { self.static_chunk_ids_per_entity .entry(chunk.entity_path().clone()) .or_default() - .entry(component_name) + .entry(component_desc.component_name) .and_modify(|cur_chunk_id| { // NOTE: When attempting to overwrite static data, the chunk with the most // recent data within -- according to RowId -- wins. @@ -87,7 +97,8 @@ impl ChunkStore { .map_or(RowId::ZERO, |chunk| { chunk .row_id_range_per_component() - .get(&component_name) + .get(&component_desc.component_name) + .and_then(|per_desc| per_desc.get(component_desc)) .map_or(RowId::ZERO, |(_, row_id_max)| *row_id_max) }); @@ -239,27 +250,29 @@ impl ChunkStore { let temporal_chunk_ids_per_component = temporal_chunk_ids_per_timeline.entry(timeline).or_default(); - for (component_name, time_range) in time_range_per_component { - let temporal_chunk_ids_per_time = temporal_chunk_ids_per_component - .entry(component_name) - .or_default(); + for (component_name, per_desc) in time_range_per_component { + for (_component_desc, time_range) in per_desc { + let temporal_chunk_ids_per_time = temporal_chunk_ids_per_component + .entry(component_name) + .or_default(); - // See `ChunkIdSetPerTime::max_interval_length`'s documentation. - temporal_chunk_ids_per_time.max_interval_length = u64::max( - temporal_chunk_ids_per_time.max_interval_length, - time_range.abs_length(), - ); + // See `ChunkIdSetPerTime::max_interval_length`'s documentation. + temporal_chunk_ids_per_time.max_interval_length = u64::max( + temporal_chunk_ids_per_time.max_interval_length, + time_range.abs_length(), + ); - temporal_chunk_ids_per_time - .per_start_time - .entry(time_range.min()) - .or_default() - .insert(chunk_or_compacted.id()); - temporal_chunk_ids_per_time - .per_end_time - .entry(time_range.max()) - .or_default() - .insert(chunk_or_compacted.id()); + temporal_chunk_ids_per_time + .per_start_time + .entry(time_range.min()) + .or_default() + .insert(chunk_or_compacted.id()); + temporal_chunk_ids_per_time + .per_end_time + .entry(time_range.max()) + .or_default() + .insert(chunk_or_compacted.id()); + } } } } @@ -338,9 +351,9 @@ impl ChunkStore { .or_default() .push(chunk.id()); - for (&component_name, list_array) in chunk.components() { + for (component_descr, list_array) in chunk.components().iter_flattened() { self.type_registry.insert( - component_name, + component_descr.component_name, Arrow2ListArray::::get_child_type(list_array.data_type()).clone(), ); @@ -348,7 +361,9 @@ impl ChunkStore { .per_column_metadata .entry(chunk.entity_path().clone()) .or_default() - .entry(component_name) + .entry(component_descr.component_name) + .or_default() + .entry(component_descr.clone()) .or_insert(ColumnMetadataState { is_semantically_empty: true, }); @@ -446,48 +461,50 @@ impl ChunkStore { continue; }; - for (component_name, time_range) in time_range_per_component { - let Some(temporal_chunk_ids_per_time) = - temporal_chunk_ids_per_component.get(&component_name) - else { - continue; - }; + for (component_name, per_desc) in time_range_per_component { + for (_component_desc, time_range) in per_desc { + let Some(temporal_chunk_ids_per_time) = + temporal_chunk_ids_per_component.get(&component_name) + else { + continue; + }; - { - // Direct neighbors (before): 1 point each. - if let Some((_data_time, chunk_id_set)) = temporal_chunk_ids_per_time - .per_start_time - .range(..time_range.min()) - .next_back() { - for &chunk_id in chunk_id_set { - if check_if_chunk_below_threshold(self, chunk_id) { - *candidates.entry(chunk_id).or_default() += 1; + // Direct neighbors (before): 1 point each. + if let Some((_data_time, chunk_id_set)) = temporal_chunk_ids_per_time + .per_start_time + .range(..time_range.min()) + .next_back() + { + for &chunk_id in chunk_id_set { + if check_if_chunk_below_threshold(self, chunk_id) { + *candidates.entry(chunk_id).or_default() += 1; + } } } - } - // Direct neighbors (after): 1 point each. - if let Some((_data_time, chunk_id_set)) = temporal_chunk_ids_per_time - .per_start_time - .range(time_range.max().inc()..) - .next() - { - for &chunk_id in chunk_id_set { - if check_if_chunk_below_threshold(self, chunk_id) { - *candidates.entry(chunk_id).or_default() += 1; + // Direct neighbors (after): 1 point each. + if let Some((_data_time, chunk_id_set)) = temporal_chunk_ids_per_time + .per_start_time + .range(time_range.max().inc()..) + .next() + { + for &chunk_id in chunk_id_set { + if check_if_chunk_below_threshold(self, chunk_id) { + *candidates.entry(chunk_id).or_default() += 1; + } } } - } - let chunk_id_set = temporal_chunk_ids_per_time - .per_start_time - .get(&time_range.min()); + let chunk_id_set = temporal_chunk_ids_per_time + .per_start_time + .get(&time_range.min()); - // Shared start times: 2 points each. - for chunk_id in chunk_id_set.iter().flat_map(|set| set.iter().copied()) { - if check_if_chunk_below_threshold(self, chunk_id) { - *candidates.entry(chunk_id).or_default() += 2; + // Shared start times: 2 points each. + for chunk_id in chunk_id_set.iter().flat_map(|set| set.iter().copied()) { + if check_if_chunk_below_threshold(self, chunk_id) { + *candidates.entry(chunk_id).or_default() += 2; + } } } } diff --git a/crates/store/re_chunk_store/tests/memory_test.rs b/crates/store/re_chunk_store/tests/memory_test.rs index 0f1c2af499794..cbbcdfa1b0f9b 100644 --- a/crates/store/re_chunk_store/tests/memory_test.rs +++ b/crates/store/re_chunk_store/tests/memory_test.rs @@ -73,7 +73,7 @@ use re_chunk::{ }; use re_chunk_store::{ChunkStore, ChunkStoreConfig}; use re_log_types::{TimePoint, TimeType, Timeline}; -use re_types::{components::Scalar, Component, Loggable}; +use re_types::{components::Scalar, Component as _, Loggable}; /// The memory overhead of storing many scalars in the store. #[test] @@ -104,7 +104,7 @@ fn scalar_memory_overhead() { let row = PendingRow::new( timepoint, - std::iter::once((Scalar::name(), scalars)).collect(), + std::iter::once((Scalar::descriptor(), scalars)).collect(), ); batcher.push_row(entity_path.clone(), row); diff --git a/crates/store/re_chunk_store/tests/reads.rs b/crates/store/re_chunk_store/tests/reads.rs index 4348efe4fee40..66b12f3b29ee4 100644 --- a/crates/store/re_chunk_store/tests/reads.rs +++ b/crates/store/re_chunk_store/tests/reads.rs @@ -12,32 +12,34 @@ use re_log_types::{ example_components::{MyColor, MyIndex, MyPoint}, EntityPath, TimeType, Timeline, }; -use re_types::testing::{build_some_large_structs, LargeStruct}; -use re_types::ComponentNameSet; -use re_types_core::{Component as _, ComponentName}; +use re_types::{ + testing::{build_some_large_structs, LargeStruct}, + ComponentDescriptor, ComponentNameSet, +}; +use re_types_core::Component as _; // --- fn query_latest_array( store: &ChunkStore, entity_path: &EntityPath, - component_name: ComponentName, + component_desc: &ComponentDescriptor, query: &LatestAtQuery, ) -> Option<(TimeInt, RowId, Box)> { re_tracing::profile_function!(); let ((data_time, row_id), unit) = store - .latest_at_relevant_chunks(query, entity_path, component_name) + .latest_at_relevant_chunks(query, entity_path, component_desc.component_name) .into_iter() .filter_map(|chunk| { chunk - .latest_at(query, component_name) + .latest_at(query, component_desc.component_name) .into_unit() .and_then(|chunk| chunk.index(&query.timeline()).map(|index| (index, chunk))) }) .max_by_key(|(index, _chunk)| *index)?; - unit.component_batch_raw(&component_name) + unit.component_batch_raw(&component_desc.component_name) .map(|array| (data_time, row_id, array)) } @@ -53,13 +55,14 @@ fn all_components() -> anyhow::Result<()> { let frame2 = TimeInt::new_temporal(2); let assert_latest_components_at = - |store: &ChunkStore, entity_path: &EntityPath, expected: Option<&[ComponentName]>| { + |store: &ChunkStore, entity_path: &EntityPath, expected: Option<&[ComponentDescriptor]>| { let timeline = Timeline::new("frame_nr", TimeType::Sequence); let component_names = store.all_components_on_timeline_sorted(&timeline, entity_path); let expected_component_names = expected.map(|expected| { - let expected: ComponentNameSet = expected.iter().copied().collect(); + let expected: ComponentNameSet = + expected.iter().map(|desc| desc.component_name).collect(); expected }); @@ -75,14 +78,14 @@ fn all_components() -> anyhow::Result<()> { ); let components_a = &[ - MyColor::name(), // added by test, static - LargeStruct::name(), // added by test + MyColor::descriptor(), // added by test, static + LargeStruct::descriptor(), // added by test ]; let components_b = &[ - MyColor::name(), // added by test, static - MyPoint::name(), // added by test - LargeStruct::name(), // added by test + MyColor::descriptor(), // added by test, static + MyPoint::descriptor(), // added by test + LargeStruct::descriptor(), // added by test ]; let chunk = Chunk::builder(entity_path.clone()) @@ -193,60 +196,61 @@ fn latest_at() -> anyhow::Result<()> { store.insert_chunk(&chunk4)?; store.insert_chunk(&chunk5)?; - let assert_latest_components = |frame_nr: TimeInt, rows: &[(ComponentName, Option)]| { - let timeline_frame_nr = Timeline::new("frame_nr", TimeType::Sequence); + let assert_latest_components = + |frame_nr: TimeInt, rows: &[(ComponentDescriptor, Option)]| { + let timeline_frame_nr = Timeline::new("frame_nr", TimeType::Sequence); - for (component_name, expected_row_id) in rows { - let row_id = query_latest_array( - &store, - &entity_path, - *component_name, - &LatestAtQuery::new(timeline_frame_nr, frame_nr), - ) - .map(|(_data_time, row_id, _array)| row_id); + for (component_desc, expected_row_id) in rows { + let row_id = query_latest_array( + &store, + &entity_path, + component_desc, + &LatestAtQuery::new(timeline_frame_nr, frame_nr), + ) + .map(|(_data_time, row_id, _array)| row_id); - assert_eq!(*expected_row_id, row_id, "{component_name}"); - } - }; + assert_eq!(*expected_row_id, row_id, "{component_desc}"); + } + }; assert_latest_components( frame0, &[ - (MyColor::name(), Some(row_id5)), // static - (MyIndex::name(), None), - (MyPoint::name(), None), + (MyColor::descriptor(), Some(row_id5)), // static + (MyIndex::descriptor(), None), + (MyPoint::descriptor(), None), ], ); assert_latest_components( frame1, &[ - (MyColor::name(), Some(row_id5)), // static - (MyIndex::name(), Some(row_id1)), - (MyPoint::name(), None), + (MyColor::descriptor(), Some(row_id5)), // static + (MyIndex::descriptor(), Some(row_id1)), + (MyPoint::descriptor(), None), ], ); assert_latest_components( frame2, &[ - (MyColor::name(), Some(row_id5)), - (MyPoint::name(), Some(row_id2)), - (MyIndex::name(), Some(row_id2)), + (MyColor::descriptor(), Some(row_id5)), + (MyPoint::descriptor(), Some(row_id2)), + (MyIndex::descriptor(), Some(row_id2)), ], ); assert_latest_components( frame3, &[ - (MyColor::name(), Some(row_id5)), - (MyPoint::name(), Some(row_id3)), - (MyIndex::name(), Some(row_id2)), + (MyColor::descriptor(), Some(row_id5)), + (MyPoint::descriptor(), Some(row_id3)), + (MyIndex::descriptor(), Some(row_id2)), ], ); assert_latest_components( frame4, &[ - (MyColor::name(), Some(row_id5)), - (MyPoint::name(), Some(row_id3)), - (MyIndex::name(), Some(row_id2)), + (MyColor::descriptor(), Some(row_id5)), + (MyPoint::descriptor(), Some(row_id3)), + (MyIndex::descriptor(), Some(row_id2)), ], ); @@ -310,24 +314,24 @@ fn latest_at_sparse_component_edge_case() -> anyhow::Result<()> { row_id1_1, [build_frame_nr(frame1)], [ - (MyIndex::name(), None), - (MyPoint::name(), Some(&MyPoint::from_iter(0..1) as _)), + (MyIndex::descriptor(), None), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(0..1) as _)), ], ) .with_sparse_component_batches( row_id1_2, [build_frame_nr(frame2)], [ - (MyIndex::name(), None), - (MyPoint::name(), Some(&MyPoint::from_iter(1..2) as _)), + (MyIndex::descriptor(), None), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(1..2) as _)), ], ) .with_sparse_component_batches( row_id1_3, [build_frame_nr(frame3)], [ - (MyIndex::name(), Some(&MyIndex::from_iter(2..3) as _)), - (MyPoint::name(), Some(&MyPoint::from_iter(2..3) as _)), + (MyIndex::descriptor(), Some(&MyIndex::from_iter(2..3) as _)), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(2..3) as _)), ], ) .build()?; @@ -345,8 +349,8 @@ fn latest_at_sparse_component_edge_case() -> anyhow::Result<()> { row_id2_1, [build_frame_nr(frame2)], [ - (MyIndex::name(), Some(&MyIndex::from_iter(2..3) as _)), - (MyPoint::name(), Some(&MyPoint::from_iter(1..2) as _)), + (MyIndex::descriptor(), Some(&MyIndex::from_iter(2..3) as _)), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(1..2) as _)), ], ) .build()?; @@ -363,7 +367,7 @@ fn latest_at_sparse_component_edge_case() -> anyhow::Result<()> { let row_id = query_latest_array( &store, &entity_path, - MyIndex::name(), + &MyIndex::descriptor(), &LatestAtQuery::new(Timeline::new_sequence("frame_nr"), TimeInt::MAX), ) .map(|(_data_time, row_id, _array)| row_id); @@ -441,22 +445,22 @@ fn latest_at_overlapped_chunks() -> anyhow::Result<()> { .with_sparse_component_batches( row_id1_1, [build_frame_nr(frame1)], - [(MyPoint::name(), Some(&points1 as _))], + [(MyPoint::descriptor(), Some(&points1 as _))], ) .with_sparse_component_batches( row_id1_3, [build_frame_nr(frame3)], - [(MyPoint::name(), Some(&points3 as _))], + [(MyPoint::descriptor(), Some(&points3 as _))], ) .with_sparse_component_batches( row_id1_5, [build_frame_nr(frame5)], - [(MyPoint::name(), Some(&points5 as _))], + [(MyPoint::descriptor(), Some(&points5 as _))], ) .with_sparse_component_batches( row_id1_7, [build_frame_nr(frame7)], - [(MyPoint::name(), Some(&points7 as _))], + [(MyPoint::descriptor(), Some(&points7 as _))], ) .build()?; @@ -470,17 +474,17 @@ fn latest_at_overlapped_chunks() -> anyhow::Result<()> { .with_sparse_component_batches( row_id2_2, [build_frame_nr(frame2)], - [(MyPoint::name(), Some(&points2 as _))], + [(MyPoint::descriptor(), Some(&points2 as _))], ) .with_sparse_component_batches( row_id2_3, [build_frame_nr(frame3)], - [(MyPoint::name(), Some(&points3 as _))], + [(MyPoint::descriptor(), Some(&points3 as _))], ) .with_sparse_component_batches( row_id2_4, [build_frame_nr(frame4)], - [(MyPoint::name(), Some(&points4 as _))], + [(MyPoint::descriptor(), Some(&points4 as _))], ) .build()?; @@ -494,17 +498,17 @@ fn latest_at_overlapped_chunks() -> anyhow::Result<()> { .with_sparse_component_batches( row_id3_2, [build_frame_nr(frame2)], - [(MyPoint::name(), Some(&points2 as _))], + [(MyPoint::descriptor(), Some(&points2 as _))], ) .with_sparse_component_batches( row_id3_4, [build_frame_nr(frame4)], - [(MyPoint::name(), Some(&points4 as _))], + [(MyPoint::descriptor(), Some(&points4 as _))], ) .with_sparse_component_batches( row_id3_6, [build_frame_nr(frame6)], - [(MyPoint::name(), Some(&points6 as _))], + [(MyPoint::descriptor(), Some(&points6 as _))], ) .build()?; @@ -524,8 +528,8 @@ fn latest_at_overlapped_chunks() -> anyhow::Result<()> { (TimeInt::MAX, row_id1_7), // ] { let query = LatestAtQuery::new(Timeline::new_sequence("frame_nr"), at); - eprintln!("{} @ {query:?}", MyPoint::name()); - let row_id = query_latest_array(&store, &entity_path, MyPoint::name(), &query) + eprintln!("{} @ {query:?}", MyPoint::descriptor()); + let row_id = query_latest_array(&store, &entity_path, &MyPoint::descriptor(), &query) .map(|(_data_time, row_id, _array)| row_id); assert_eq!(expected_row_id, row_id.unwrap()); } @@ -711,17 +715,18 @@ fn range() -> anyhow::Result<()> { #[allow(clippy::type_complexity)] let assert_range_components = |time_range: ResolvedTimeRange, - component_name: ComponentName, + component_desc: ComponentDescriptor, row_ids_at_times: &[(TimeInt, RowId)]| { let timeline_frame_nr = Timeline::new("frame_nr", TimeType::Sequence); let query = RangeQuery::new(timeline_frame_nr, time_range); - let results = store.range_relevant_chunks(&query, &entity_path, component_name); + let results = + store.range_relevant_chunks(&query, &entity_path, component_desc.component_name); - eprintln!("================= {component_name} @ {query:?} ==============="); + eprintln!("================= {component_desc} @ {query:?} ==============="); let mut results_processed = 0usize; for chunk in results { - let chunk = chunk.range(&query, component_name); + let chunk = chunk.range(&query, component_desc.component_name); eprintln!("{chunk}"); for (data_time, row_id) in chunk.iter_indices(&timeline_frame_nr) { let (expected_data_time, expected_row_id) = row_ids_at_times[results_processed]; @@ -740,52 +745,60 @@ fn range() -> anyhow::Result<()> { assert_range_components( ResolvedTimeRange::new(frame1, frame1), - MyColor::name(), + MyColor::descriptor(), &[(TimeInt::STATIC, row_id5)], ); - assert_range_components(ResolvedTimeRange::new(frame1, frame1), MyPoint::name(), &[]); + assert_range_components( + ResolvedTimeRange::new(frame1, frame1), + MyPoint::descriptor(), + &[], + ); assert_range_components( ResolvedTimeRange::new(frame2, frame2), - MyColor::name(), + MyColor::descriptor(), &[(TimeInt::STATIC, row_id5)], ); assert_range_components( ResolvedTimeRange::new(frame2, frame2), - MyPoint::name(), + MyPoint::descriptor(), &[(frame2, row_id2)], ); assert_range_components( ResolvedTimeRange::new(frame3, frame3), - MyColor::name(), + MyColor::descriptor(), &[(TimeInt::STATIC, row_id5)], ); assert_range_components( ResolvedTimeRange::new(frame3, frame3), - MyPoint::name(), + MyPoint::descriptor(), &[(frame3, row_id3)], ); assert_range_components( ResolvedTimeRange::new(frame4, frame4), - MyColor::name(), + MyColor::descriptor(), &[(TimeInt::STATIC, row_id5)], ); assert_range_components( ResolvedTimeRange::new(frame4, frame4), - MyPoint::name(), + MyPoint::descriptor(), &[(frame4, row_id4_25), (frame4, row_id4_4)], ); assert_range_components( ResolvedTimeRange::new(frame5, frame5), - MyColor::name(), + MyColor::descriptor(), &[(TimeInt::STATIC, row_id5)], ); - assert_range_components(ResolvedTimeRange::new(frame5, frame5), MyPoint::name(), &[]); + assert_range_components( + ResolvedTimeRange::new(frame5, frame5), + MyPoint::descriptor(), + &[], + ); // Full range assert_range_components( ResolvedTimeRange::new(frame1, frame5), - MyPoint::name(), + MyPoint::descriptor(), &[ (frame2, row_id2), (frame3, row_id3), @@ -795,7 +808,7 @@ fn range() -> anyhow::Result<()> { ); assert_range_components( ResolvedTimeRange::new(frame1, frame5), - MyColor::name(), + MyColor::descriptor(), &[(TimeInt::STATIC, row_id5)], ); @@ -803,7 +816,7 @@ fn range() -> anyhow::Result<()> { assert_range_components( ResolvedTimeRange::new(TimeInt::MIN, TimeInt::MAX), - MyPoint::name(), + MyPoint::descriptor(), &[ (frame2, row_id2), (frame3, row_id3), @@ -813,7 +826,7 @@ fn range() -> anyhow::Result<()> { ); assert_range_components( ResolvedTimeRange::new(TimeInt::MIN, TimeInt::MAX), - MyColor::name(), + MyColor::descriptor(), &[(TimeInt::STATIC, row_id5)], ); @@ -934,32 +947,32 @@ fn range_overlapped_chunks() -> anyhow::Result<()> { .with_sparse_component_batches( row_id1_1, [build_frame_nr(frame1)], - [(MyPoint::name(), Some(&points1 as _))], + [(MyPoint::descriptor(), Some(&points1 as _))], ) .with_sparse_component_batches( row_id1_3, [build_frame_nr(frame3)], - [(MyPoint::name(), Some(&points3 as _))], + [(MyPoint::descriptor(), Some(&points3 as _))], ) .with_sparse_component_batches( row_id1_5, [build_frame_nr(frame5)], - [(MyPoint::name(), Some(&points5 as _))], + [(MyPoint::descriptor(), Some(&points5 as _))], ) .with_sparse_component_batches( row_id1_7_1, [build_frame_nr(frame7)], - [(MyPoint::name(), Some(&points7_1 as _))], + [(MyPoint::descriptor(), Some(&points7_1 as _))], ) .with_sparse_component_batches( row_id1_7_2, [build_frame_nr(frame7)], - [(MyPoint::name(), Some(&points7_2 as _))], + [(MyPoint::descriptor(), Some(&points7_2 as _))], ) .with_sparse_component_batches( row_id1_7_3, [build_frame_nr(frame7)], - [(MyPoint::name(), Some(&points7_3 as _))], + [(MyPoint::descriptor(), Some(&points7_3 as _))], ) .build()?; @@ -977,17 +990,17 @@ fn range_overlapped_chunks() -> anyhow::Result<()> { .with_sparse_component_batches( row_id2_2, [build_frame_nr(frame2)], - [(MyPoint::name(), Some(&points2 as _))], + [(MyPoint::descriptor(), Some(&points2 as _))], ) .with_sparse_component_batches( row_id2_3, [build_frame_nr(frame3)], - [(MyPoint::name(), Some(&points3 as _))], + [(MyPoint::descriptor(), Some(&points3 as _))], ) .with_sparse_component_batches( row_id2_4, [build_frame_nr(frame4)], - [(MyPoint::name(), Some(&points4 as _))], + [(MyPoint::descriptor(), Some(&points4 as _))], ) .build()?; diff --git a/crates/store/re_chunk_store/tests/snapshots/memory_test__scalars_on_one_timeline_new.snap b/crates/store/re_chunk_store/tests/snapshots/memory_test__scalars_on_one_timeline_new.snap index 150652c42eefe..6d6b6432b1760 100644 --- a/crates/store/re_chunk_store/tests/snapshots/memory_test__scalars_on_one_timeline_new.snap +++ b/crates/store/re_chunk_store/tests/snapshots/memory_test__scalars_on_one_timeline_new.snap @@ -4,6 +4,6 @@ expression: "[format!(\"{NUM_SCALARS} scalars\"),\n format!(\"{} in total --- [ "1048576 scalars", - "37.0 MiB in total", + "37.1 MiB in total", "37 B per row", ] diff --git a/crates/store/re_chunk_store/tests/stats.rs b/crates/store/re_chunk_store/tests/stats.rs index 772814961bad7..ad60b89c4dafc 100644 --- a/crates/store/re_chunk_store/tests/stats.rs +++ b/crates/store/re_chunk_store/tests/stats.rs @@ -26,24 +26,24 @@ fn stats() -> anyhow::Result<()> { RowId::new(), [build_frame_nr(TimeInt::new_temporal(0))], [ - (MyColor::name(), None), - (MyPoint::name(), Some(&MyPoint::from_iter(0..1) as _)), + (MyColor::descriptor(), None), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(0..1) as _)), ], ) .with_sparse_component_batches( RowId::new(), [build_frame_nr(TimeInt::new_temporal(1))], [ - (MyColor::name(), Some(&MyColor::from_iter(2..3) as _)), - (MyPoint::name(), None), + (MyColor::descriptor(), Some(&MyColor::from_iter(2..3) as _)), + (MyPoint::descriptor(), None), ], ) .with_sparse_component_batches( RowId::new(), [build_frame_nr(TimeInt::new_temporal(2))], [ - (MyColor::name(), Some(&MyColor::from_iter(2..3) as _)), - (MyPoint::name(), Some(&MyPoint::from_iter(2..3) as _)), + (MyColor::descriptor(), Some(&MyColor::from_iter(2..3) as _)), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(2..3) as _)), ], ) .build()?; @@ -63,8 +63,8 @@ fn stats() -> anyhow::Result<()> { RowId::new(), [build_frame_nr(TimeInt::new_temporal(3))], [ - (MyColor::name(), None), - (MyPoint::name(), Some(&MyPoint::from_iter(1..2) as _)), + (MyColor::descriptor(), None), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(1..2) as _)), ], ) .build()?; @@ -88,24 +88,24 @@ fn stats() -> anyhow::Result<()> { RowId::new(), TimePoint::default(), [ - (MyColor::name(), None), - (MyPoint::name(), Some(&MyPoint::from_iter(0..1) as _)), + (MyColor::descriptor(), None), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(0..1) as _)), ], ) .with_sparse_component_batches( RowId::new(), TimePoint::default(), [ - (MyColor::name(), Some(&MyColor::from_iter(2..3) as _)), - (MyPoint::name(), None), + (MyColor::descriptor(), Some(&MyColor::from_iter(2..3) as _)), + (MyPoint::descriptor(), None), ], ) .with_sparse_component_batches( RowId::new(), TimePoint::default(), [ - (MyColor::name(), Some(&MyColor::from_iter(2..3) as _)), - (MyPoint::name(), Some(&MyPoint::from_iter(2..3) as _)), + (MyColor::descriptor(), Some(&MyColor::from_iter(2..3) as _)), + (MyPoint::descriptor(), Some(&MyPoint::from_iter(2..3) as _)), ], ) .build()?; diff --git a/crates/store/re_data_loader/src/loader_archetype.rs b/crates/store/re_data_loader/src/loader_archetype.rs index bbfc57f1cc479..7ed62c2d1f281 100644 --- a/crates/store/re_data_loader/src/loader_archetype.rs +++ b/crates/store/re_data_loader/src/loader_archetype.rs @@ -220,10 +220,13 @@ fn load_video( std::iter::once((video_timeline, time_column)).collect(), [ ( - VideoFrameReference::indicator().name(), + VideoFrameReference::indicator().descriptor().into_owned(), video_frame_reference_indicators_list_array, ), - (video_timestamp_batch.name(), video_timestamp_list_array), + ( + video_timestamp_batch.descriptor().into_owned(), + video_timestamp_list_array, + ), ] .into_iter() .collect(), diff --git a/crates/store/re_dataframe/src/query.rs b/crates/store/re_dataframe/src/query.rs index 6c9c31763ce5d..535187b354f28 100644 --- a/crates/store/re_dataframe/src/query.rs +++ b/crates/store/re_dataframe/src/query.rs @@ -28,7 +28,7 @@ use re_chunk_store::{ }; use re_log_types::ResolvedTimeRange; use re_query::{QueryCache, StorageEngineLike}; -use re_types_core::components::ClearIsRecursive; +use re_types_core::{components::ClearIsRecursive, ComponentDescriptor}; use crate::RecordBatch; @@ -251,7 +251,11 @@ impl QueryHandle { #[allow(clippy::unwrap_used)] chunk .add_component( - descr.component_name, + re_types_core::ComponentDescriptor { + component_name: descr.component_name, + archetype_name: descr.archetype_name, + archetype_field_name: descr.archetype_field_name, + }, re_chunk::util::new_list_array_of_empties( child_datatype, chunk.num_rows(), @@ -330,8 +334,11 @@ impl QueryHandle { let query = re_chunk::LatestAtQuery::new(Timeline::default(), TimeInt::STATIC); - let results = - cache.latest_at(&query, &descr.entity_path, [descr.component_name]); + let results = cache.latest_at( + &query, + &descr.entity_path, + [ComponentDescriptor::from(descr)], + ); results.components.get(&descr.component_name).cloned() } @@ -457,13 +464,7 @@ impl QueryHandle { ColumnDescriptor::Component(column) => { let chunks = self - .fetch_chunks( - store, - cache, - query, - &column.entity_path, - [column.component_name], - ) + .fetch_chunks(store, cache, query, &column.entity_path, [&column.into()]) .unwrap_or_default(); if let Some(pov) = self.query.filtered_is_not_null.as_ref() { @@ -513,7 +514,9 @@ impl QueryHandle { /// Returns `None` if the chunk either doesn't contain a `ClearIsRecursive` column or if /// the end result is an empty chunk. fn chunk_filter_recursive_only(chunk: &Chunk) -> Option { - let list_array = chunk.components().get(&ClearIsRecursive::name())?; + let list_array = chunk + .components() + .get_descriptor(&ClearIsRecursive::descriptor())?; let values = list_array .values() @@ -536,7 +539,7 @@ impl QueryHandle { } use re_types_core::Component as _; - let component_names = [re_types_core::components::ClearIsRecursive::name()]; + let component_descrs = [&ComponentDescriptor::new(ClearIsRecursive::name())]; // All unique entity paths present in the view contents. let entity_paths: IntSet = view_contents @@ -553,7 +556,7 @@ impl QueryHandle { // For the entity itself, any chunk that contains clear data is relevant, recursive or not. // Just fetch everything we find. let flat_chunks = self - .fetch_chunks(store, cache, query, entity_path, component_names) + .fetch_chunks(store, cache, query, entity_path, component_descrs) .map(|chunks| { chunks .into_iter() @@ -564,7 +567,7 @@ impl QueryHandle { let recursive_chunks = entity_path_ancestors(entity_path).flat_map(|ancestor_path| { - self.fetch_chunks(store, cache, query, &ancestor_path, component_names) + self.fetch_chunks(store, cache, query, &ancestor_path, component_descrs) .into_iter() // option .flat_map(|chunks| chunks.into_iter().map(|(_cursor, chunk)| chunk)) // NOTE: Ancestors' chunks are only relevant for the rows where `ClearIsRecursive=true`. @@ -584,13 +587,13 @@ impl QueryHandle { .collect() } - fn fetch_chunks( + fn fetch_chunks<'a>( &self, _store: &ChunkStore, cache: &QueryCache, query: &RangeQuery, entity_path: &EntityPath, - component_names: [ComponentName; N], + component_descrs: impl IntoIterator, ) -> Option> { // NOTE: Keep in mind that the range APIs natively make sure that we will // either get a bunch of relevant _static_ chunks, or a bunch of relevant @@ -598,7 +601,7 @@ impl QueryHandle { // // TODO(cmc): Going through the cache is very useful in a Viewer context, but // not so much in an SDK context. Make it configurable. - let results = cache.range(query, entity_path, component_names); + let results = cache.range(query, entity_path, component_descrs); debug_assert!( results.components.len() <= 1, @@ -1061,8 +1064,11 @@ impl QueryHandle { let query = re_chunk::LatestAtQuery::new(state.filtered_index, *cur_index_value); - let results = - cache.latest_at(&query, &descr.entity_path, [descr.component_name]); + let results = cache.latest_at( + &query, + &descr.entity_path, + [ComponentDescriptor::from(descr)], + ); *streaming_state = results .components @@ -1159,24 +1165,28 @@ impl QueryHandle { let list_array = match streaming_state { StreamingJoinState::StreamingJoinState(s) => { debug_assert!( - s.chunk.components().len() <= 1, + s.chunk.components().iter_flattened().count() <= 1, "cannot possibly get more than one component with this query" ); s.chunk .components() - .iter() + .iter_flattened() .next() .map(|(_, list_array)| list_array.sliced(s.cursor as usize, 1)) } StreamingJoinState::Retrofilled(unit) => { - let component_name = state.view_contents.get(view_idx).and_then(|col| match col { - ColumnDescriptor::Component(descr) => Some(descr.component_name), + let component_desc = state.view_contents.get(view_idx).and_then(|col| match col { + ColumnDescriptor::Component(descr) => Some(re_types_core::ComponentDescriptor { + component_name: descr.component_name, + archetype_name: descr.archetype_name, + archetype_field_name: descr.archetype_field_name, + }), ColumnDescriptor::Time(_) => None, })?; - unit.components().get(&component_name).map(|list_array| list_array.to_boxed()) + unit.components().get_descriptor(&component_desc).map(|list_array| list_array.to_boxed()) } }; @@ -2698,41 +2708,41 @@ mod tests { row_id1_1, [build_frame_nr(frame1), build_log_time(frame1.into())], [ - (MyPoint::name(), Some(&points1 as _)), - (MyColor::name(), None), - (MyLabel::name(), Some(&labels1 as _)), // shadowed by static + (MyPoint::descriptor(), Some(&points1 as _)), + (MyColor::descriptor(), None), + (MyLabel::descriptor(), Some(&labels1 as _)), // shadowed by static ], ) .with_sparse_component_batches( row_id1_3, [build_frame_nr(frame3), build_log_time(frame3.into())], [ - (MyPoint::name(), Some(&points3 as _)), - (MyColor::name(), Some(&colors3 as _)), + (MyPoint::descriptor(), Some(&points3 as _)), + (MyColor::descriptor(), Some(&colors3 as _)), ], ) .with_sparse_component_batches( row_id1_5, [build_frame_nr(frame5), build_log_time(frame5.into())], [ - (MyPoint::name(), Some(&points5 as _)), - (MyColor::name(), None), + (MyPoint::descriptor(), Some(&points5 as _)), + (MyColor::descriptor(), None), ], ) .with_sparse_component_batches( row_id1_7_1, [build_frame_nr(frame7), build_log_time(frame7.into())], - [(MyPoint::name(), Some(&points7_1 as _))], + [(MyPoint::descriptor(), Some(&points7_1 as _))], ) .with_sparse_component_batches( row_id1_7_2, [build_frame_nr(frame7), build_log_time(frame7.into())], - [(MyPoint::name(), Some(&points7_2 as _))], + [(MyPoint::descriptor(), Some(&points7_2 as _))], ) .with_sparse_component_batches( row_id1_7_3, [build_frame_nr(frame7), build_log_time(frame7.into())], - [(MyPoint::name(), Some(&points7_3 as _))], + [(MyPoint::descriptor(), Some(&points7_3 as _))], ) .build()?; @@ -2750,20 +2760,20 @@ mod tests { .with_sparse_component_batches( row_id2_2, [build_frame_nr(frame2)], - [(MyPoint::name(), Some(&points2 as _))], + [(MyPoint::descriptor(), Some(&points2 as _))], ) .with_sparse_component_batches( row_id2_3, [build_frame_nr(frame3)], [ - (MyPoint::name(), Some(&points3 as _)), - (MyColor::name(), Some(&colors3 as _)), + (MyPoint::descriptor(), Some(&points3 as _)), + (MyColor::descriptor(), Some(&colors3 as _)), ], ) .with_sparse_component_batches( row_id2_4, [build_frame_nr(frame4)], - [(MyPoint::name(), Some(&points4 as _))], + [(MyPoint::descriptor(), Some(&points4 as _))], ) .build()?; @@ -2777,17 +2787,17 @@ mod tests { .with_sparse_component_batches( row_id3_2, [build_frame_nr(frame2)], - [(MyPoint::name(), Some(&points2 as _))], + [(MyPoint::descriptor(), Some(&points2 as _))], ) .with_sparse_component_batches( row_id3_4, [build_frame_nr(frame4)], - [(MyPoint::name(), Some(&points4 as _))], + [(MyPoint::descriptor(), Some(&points4 as _))], ) .with_sparse_component_batches( row_id3_6, [build_frame_nr(frame6)], - [(MyPoint::name(), Some(&points6 as _))], + [(MyPoint::descriptor(), Some(&points6 as _))], ) .build()?; @@ -2801,17 +2811,17 @@ mod tests { .with_sparse_component_batches( row_id4_4, [build_frame_nr(frame4)], - [(MyColor::name(), Some(&colors4 as _))], + [(MyColor::descriptor(), Some(&colors4 as _))], ) .with_sparse_component_batches( row_id4_5, [build_frame_nr(frame5)], - [(MyColor::name(), Some(&colors5 as _))], + [(MyColor::descriptor(), Some(&colors5 as _))], ) .with_sparse_component_batches( row_id4_7, [build_frame_nr(frame7)], - [(MyColor::name(), Some(&colors7 as _))], + [(MyColor::descriptor(), Some(&colors7 as _))], ) .build()?; @@ -2823,7 +2833,7 @@ mod tests { .with_sparse_component_batches( row_id5_1, TimePoint::default(), - [(MyLabel::name(), Some(&labels2 as _))], + [(MyLabel::descriptor(), Some(&labels2 as _))], ) .build()?; @@ -2835,7 +2845,7 @@ mod tests { .with_sparse_component_batches( row_id6_1, TimePoint::default(), - [(MyLabel::name(), Some(&labels3 as _))], + [(MyLabel::descriptor(), Some(&labels3 as _))], ) .build()?; @@ -2863,7 +2873,7 @@ mod tests { .with_sparse_component_batches( row_id1_1, TimePoint::default(), - [(ClearIsRecursive::name(), Some(&clear_flat as _))], + [(ClearIsRecursive::descriptor(), Some(&clear_flat as _))], ) .build()?; @@ -2885,7 +2895,7 @@ mod tests { .with_sparse_component_batches( row_id2_1, [build_frame_nr(frame35), build_log_time(frame35.into())], - [(ClearIsRecursive::name(), Some(&clear_recursive as _))], + [(ClearIsRecursive::descriptor(), Some(&clear_recursive as _))], ) .build()?; @@ -2897,17 +2907,17 @@ mod tests { .with_sparse_component_batches( row_id3_1, [build_frame_nr(frame55), build_log_time(frame55.into())], - [(ClearIsRecursive::name(), Some(&clear_flat as _))], + [(ClearIsRecursive::descriptor(), Some(&clear_flat as _))], ) .with_sparse_component_batches( row_id3_1, [build_frame_nr(frame60), build_log_time(frame60.into())], - [(ClearIsRecursive::name(), Some(&clear_recursive as _))], + [(ClearIsRecursive::descriptor(), Some(&clear_recursive as _))], ) .with_sparse_component_batches( row_id3_1, [build_frame_nr(frame65), build_log_time(frame65.into())], - [(ClearIsRecursive::name(), Some(&clear_flat as _))], + [(ClearIsRecursive::descriptor(), Some(&clear_flat as _))], ) .build()?; @@ -2919,7 +2929,7 @@ mod tests { .with_sparse_component_batches( row_id4_1, [build_frame_nr(frame60), build_log_time(frame60.into())], - [(ClearIsRecursive::name(), Some(&clear_flat as _))], + [(ClearIsRecursive::descriptor(), Some(&clear_flat as _))], ) .build()?; @@ -2931,7 +2941,7 @@ mod tests { .with_sparse_component_batches( row_id5_1, [build_frame_nr(frame65), build_log_time(frame65.into())], - [(ClearIsRecursive::name(), Some(&clear_recursive as _))], + [(ClearIsRecursive::descriptor(), Some(&clear_recursive as _))], ) .build()?; diff --git a/crates/store/re_entity_db/src/entity_db.rs b/crates/store/re_entity_db/src/entity_db.rs index ee9c3d09a46cb..0d2563d557e53 100644 --- a/crates/store/re_entity_db/src/entity_db.rs +++ b/crates/store/re_entity_db/src/entity_db.rs @@ -172,11 +172,11 @@ impl EntityDb { entity_path: &EntityPath, query: &re_chunk_store::LatestAtQuery, ) -> Option<((TimeInt, RowId), C)> { - let results = self - .storage_engine - .read() - .cache() - .latest_at(query, entity_path, [C::name()]); + let results = + self.storage_engine + .read() + .cache() + .latest_at(query, entity_path, [&C::descriptor()]); results .component_mono() .map(|value| (results.index(), value)) @@ -196,11 +196,11 @@ impl EntityDb { entity_path: &EntityPath, query: &re_chunk_store::LatestAtQuery, ) -> Option<((TimeInt, RowId), C)> { - let results = self - .storage_engine - .read() - .cache() - .latest_at(query, entity_path, [C::name()]); + let results = + self.storage_engine + .read() + .cache() + .latest_at(query, entity_path, [&C::descriptor()]); results .component_mono_quiet() .map(|value| (results.index(), value)) diff --git a/crates/store/re_entity_db/tests/clear.rs b/crates/store/re_entity_db/tests/clear.rs index f4a8d0285f839..c72944b49b823 100644 --- a/crates/store/re_entity_db/tests/clear.rs +++ b/crates/store/re_entity_db/tests/clear.rs @@ -24,7 +24,7 @@ fn query_latest_component( let results = db .storage_engine() .cache() - .latest_at(query, entity_path, [C::name()]); + .latest_at(query, entity_path, [C::descriptor()]); let (data_time, row_id) = results.index(); let data = results.component_mono::()?; @@ -125,7 +125,10 @@ fn clears() -> anyhow::Result<()> { .with_component_batches( row_id, timepoint, - clear.as_component_batches().iter().map(|b| b.as_ref()), + clear + .as_component_batches() + .iter() + .map(|b| b as &dyn re_types_core::ComponentBatch), ) .build()?; @@ -163,7 +166,10 @@ fn clears() -> anyhow::Result<()> { .with_component_batches( row_id, timepoint, - clear.as_component_batches().iter().map(|b| b.as_ref()), + clear + .as_component_batches() + .iter() + .map(|b| b as &dyn re_types_core::ComponentBatch), ) .build()?; @@ -348,7 +354,10 @@ fn clears_respect_index_order() -> anyhow::Result<()> { .with_component_batches( row_id1, // older row id! timepoint.clone(), - clear.as_component_batches().iter().map(|b| b.as_ref()), + clear + .as_component_batches() + .iter() + .map(|b| b as &dyn re_types_core::ComponentBatch), ) .build()?; @@ -372,7 +381,10 @@ fn clears_respect_index_order() -> anyhow::Result<()> { .with_component_batches( row_id3, // newer row id! timepoint.clone(), - clear.as_component_batches().iter().map(|b| b.as_ref()), + clear + .as_component_batches() + .iter() + .map(|b| b as &dyn re_types_core::ComponentBatch), ) .build()?; diff --git a/crates/store/re_format_arrow/src/lib.rs b/crates/store/re_format_arrow/src/lib.rs index f304232814a85..a2c711cbcffff 100644 --- a/crates/store/re_format_arrow/src/lib.rs +++ b/crates/store/re_format_arrow/src/lib.rs @@ -190,7 +190,7 @@ impl std::fmt::Display for DisplayMetadata<'_> { f.write_str( &metadata .iter() - .map(|(key, value)| format!("{prefix}{}: {value:?}", trim_name(key))) + .map(|(key, value)| format!("{prefix}{}: {:?}", trim_name(key), trim_name(value))) .collect::>() .join("\n"), ) diff --git a/crates/store/re_log_types/src/example_components.rs b/crates/store/re_log_types/src/example_components.rs index 389e83b85a428..5ee3df3a3a819 100644 --- a/crates/store/re_log_types/src/example_components.rs +++ b/crates/store/re_log_types/src/example_components.rs @@ -2,7 +2,7 @@ use std::sync::Arc; -use re_types_core::{Component, ComponentName, DeserializationError, Loggable, SizeBytes}; +use re_types_core::{Component, ComponentDescriptor, DeserializationError, Loggable, SizeBytes}; // ---------------------------------------------------------------------------- @@ -24,15 +24,15 @@ impl re_types_core::Archetype for MyPoints { "MyPoints" } - fn required_components() -> ::std::borrow::Cow<'static, [re_types_core::ComponentName]> { - vec![MyPoint::name()].into() + fn required_components() -> ::std::borrow::Cow<'static, [re_types_core::ComponentDescriptor]> { + vec![MyPoint::descriptor()].into() } - fn recommended_components() -> std::borrow::Cow<'static, [re_types_core::ComponentName]> { + fn recommended_components() -> std::borrow::Cow<'static, [re_types_core::ComponentDescriptor]> { vec![ - re_types_core::ComponentBatch::name(&Self::Indicator::default()), - MyColor::name(), - MyLabel::name(), + re_types_core::ComponentBatch::descriptor(&Self::Indicator::default()).into_owned(), + MyColor::descriptor(), + MyLabel::descriptor(), ] .into() } @@ -142,8 +142,8 @@ impl Loggable for MyPoint { } impl Component for MyPoint { - fn name() -> ComponentName { - "example.MyPoint".into() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("example.MyPoint") } } @@ -251,8 +251,8 @@ impl Loggable for MyPoint64 { } impl Component for MyPoint64 { - fn name() -> ComponentName { - "example.MyPoint64".into() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("example.MyPoint64") } } @@ -325,8 +325,8 @@ impl Loggable for MyColor { } impl Component for MyColor { - fn name() -> ComponentName { - "example.MyColor".into() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("example.MyColor") } } @@ -376,8 +376,8 @@ impl Loggable for MyLabel { } impl Component for MyLabel { - fn name() -> ComponentName { - "example.MyLabel".into() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("example.MyLabel") } } @@ -436,7 +436,7 @@ impl Loggable for MyIndex { } impl Component for MyIndex { - fn name() -> ComponentName { - "example.MyIndex".into() + fn descriptor() -> re_types_core::ComponentDescriptor { + ComponentDescriptor::new("example.MyIndex") } } diff --git a/crates/store/re_query/benches/latest_at.rs b/crates/store/re_query/benches/latest_at.rs index f2cff236ba6b7..744d8c99b59ef 100644 --- a/crates/store/re_query/benches/latest_at.rs +++ b/crates/store/re_query/benches/latest_at.rs @@ -278,7 +278,7 @@ fn query_and_visit_points(caches: &QueryCache, paths: &[EntityPath]) -> Vec().unwrap(); @@ -310,7 +310,7 @@ fn query_and_visit_strings(caches: &QueryCache, paths: &[EntityPath]) -> Vec().unwrap(); diff --git a/crates/store/re_query/examples/latest_at.rs b/crates/store/re_query/examples/latest_at.rs index 362e9481ce7ce..7ef6a93abb4c5 100644 --- a/crates/store/re_query/examples/latest_at.rs +++ b/crates/store/re_query/examples/latest_at.rs @@ -30,7 +30,7 @@ fn main() -> anyhow::Result<()> { let results: LatestAtResults = caches.latest_at( &query, &entity_path.into(), - MyPoints::all_components().iter().copied(), // no generics! + MyPoints::all_components().iter(), // no generics! ); // The results can be accessed either through the low-level Chunk APIs, or the higher-level helpers. diff --git a/crates/store/re_query/examples/range.rs b/crates/store/re_query/examples/range.rs index a5ec04ef71736..e901278017064 100644 --- a/crates/store/re_query/examples/range.rs +++ b/crates/store/re_query/examples/range.rs @@ -26,7 +26,7 @@ fn main() -> anyhow::Result<()> { let results: RangeResults = caches.range( &query, &entity_path.into(), - MyPoints::all_components().iter().copied(), // no generics! + MyPoints::all_components().iter(), // no generics! ); // * `get_required` returns an error if the chunk is missing. diff --git a/crates/store/re_query/src/cache.rs b/crates/store/re_query/src/cache.rs index d0ccbb48d98ce..a6e7edf16492c 100644 --- a/crates/store/re_query/src/cache.rs +++ b/crates/store/re_query/src/cache.rs @@ -327,59 +327,63 @@ impl ChunkStoreSubscriber for QueryCache { } for (timeline, per_component) in chunk.time_range_per_component() { - for (component_name, time_range) in per_component { - let key = QueryCacheKey::new( - chunk.entity_path().clone(), - timeline, - component_name, - ); - - // latest-at - { - let mut data_time_min = time_range.min(); - - // If a compaction was triggered, make sure to drop the original chunks too. - if let Some(ChunkCompactionReport { - srcs: compacted_chunks, - new_chunk: _, - }) = compacted + for (component_name, per_desc) in per_component { + for (component_desc, time_range) in per_desc { + let key = QueryCacheKey::new( + chunk.entity_path().clone(), + timeline, + component_name, + ); + + // latest-at { - for chunk in compacted_chunks.values() { - let data_time_compacted = chunk - .time_range_per_component() - .get(&timeline) - .and_then(|per_component| { - per_component.get(&component_name) - }) - .map_or(TimeInt::MAX, |time_range| time_range.min()); - - data_time_min = - TimeInt::min(data_time_min, data_time_compacted); + let mut data_time_min = time_range.min(); + + // If a compaction was triggered, make sure to drop the original chunks too. + if let Some(ChunkCompactionReport { + srcs: compacted_chunks, + new_chunk: _, + }) = compacted + { + for chunk in compacted_chunks.values() { + let data_time_compacted = chunk + .time_range_per_component() + .get(&timeline) + .and_then(|per_component| { + per_component.get(&component_name).and_then( + |per_desc| per_desc.get(&component_desc), + ) + }) + .map_or(TimeInt::MAX, |time_range| time_range.min()); + + data_time_min = + TimeInt::min(data_time_min, data_time_compacted); + } } - } - compacted_events - .temporal_latest_at - .entry(key.clone()) - .and_modify(|time| *time = TimeInt::min(*time, data_time_min)) - .or_insert(data_time_min); - } + compacted_events + .temporal_latest_at + .entry(key.clone()) + .and_modify(|time| *time = TimeInt::min(*time, data_time_min)) + .or_insert(data_time_min); + } - // range - { - let compacted_events = - compacted_events.temporal_range.entry(key).or_default(); - - compacted_events.insert(chunk.id()); - // If a compaction was triggered, make sure to drop the original chunks too. - compacted_events.extend(compacted.iter().flat_map( - |ChunkCompactionReport { - srcs: compacted_chunks, - new_chunk: _, - }| { - compacted_chunks.keys().copied() - }, - )); + // range + { + let compacted_events = + compacted_events.temporal_range.entry(key).or_default(); + + compacted_events.insert(chunk.id()); + // If a compaction was triggered, make sure to drop the original chunks too. + compacted_events.extend(compacted.iter().flat_map( + |ChunkCompactionReport { + srcs: compacted_chunks, + new_chunk: _, + }| { + compacted_chunks.keys().copied() + }, + )); + } } } } diff --git a/crates/store/re_query/src/latest_at.rs b/crates/store/re_query/src/latest_at.rs index ba3bfb89715d2..e4f641665dd6a 100644 --- a/crates/store/re_query/src/latest_at.rs +++ b/crates/store/re_query/src/latest_at.rs @@ -1,4 +1,5 @@ use std::{ + borrow::Cow, collections::{BTreeMap, BTreeSet}, sync::Arc, }; @@ -10,7 +11,9 @@ use parking_lot::RwLock; use re_chunk::{Chunk, RowId, UnitChunkShared}; use re_chunk_store::{ChunkStore, LatestAtQuery, TimeInt}; use re_log_types::EntityPath; -use re_types_core::{components::ClearIsRecursive, Component, ComponentName, SizeBytes}; +use re_types_core::{ + components::ClearIsRecursive, Component, ComponentDescriptor, ComponentName, SizeBytes, +}; use crate::{QueryCache, QueryCacheKey, QueryError}; @@ -39,11 +42,11 @@ impl QueryCache { /// See [`LatestAtResults`] for more information about how to handle the results. /// /// This is a cached API -- data will be lazily cached upon access. - pub fn latest_at( + pub fn latest_at<'d>( &self, query: &LatestAtQuery, entity_path: &EntityPath, - component_names: impl IntoIterator, + component_descrs: impl IntoIterator>>, ) -> LatestAtResults { re_tracing::profile_function!(entity_path.to_string()); @@ -54,8 +57,15 @@ impl QueryCache { // NOTE: This pre-filtering is extremely important: going through all these query layers // has non-negligible overhead even if the final result ends up being nothing, and our // number of queries for a frame grows linearly with the number of entity paths. - let component_names = component_names.into_iter().filter(|component_name| { - store.entity_has_component_on_timeline(&query.timeline(), entity_path, component_name) + let component_names = component_descrs.into_iter().filter_map(|component_descr| { + let component_descr = component_descr.into(); + store + .entity_has_component_on_timeline( + &query.timeline(), + entity_path, + &component_descr.component_name, + ) + .then_some(component_descr.component_name) }); // Query-time clears diff --git a/crates/store/re_query/src/range.rs b/crates/store/re_query/src/range.rs index a6a47f070b95e..6680b61c6d98e 100644 --- a/crates/store/re_query/src/range.rs +++ b/crates/store/re_query/src/range.rs @@ -1,4 +1,4 @@ -use std::{collections::BTreeSet, sync::Arc}; +use std::{borrow::Cow, collections::BTreeSet, sync::Arc}; use ahash::HashMap; use nohash_hasher::IntMap; @@ -7,7 +7,7 @@ use parking_lot::RwLock; use re_chunk::{Chunk, ChunkId}; use re_chunk_store::{ChunkStore, RangeQuery, TimeInt}; use re_log_types::{EntityPath, ResolvedTimeRange}; -use re_types_core::{ComponentName, DeserializationError, SizeBytes}; +use re_types_core::{ComponentDescriptor, ComponentName, DeserializationError, SizeBytes}; use crate::{QueryCache, QueryCacheKey}; @@ -19,11 +19,11 @@ impl QueryCache { /// See [`RangeResults`] for more information about how to handle the results. /// /// This is a cached API -- data will be lazily cached upon access. - pub fn range( + pub fn range<'a>( &self, query: &RangeQuery, entity_path: &EntityPath, - component_names: impl IntoIterator, + component_descrs: impl IntoIterator>>, ) -> RangeResults { re_tracing::profile_function!(entity_path.to_string()); @@ -34,8 +34,15 @@ impl QueryCache { // NOTE: This pre-filtering is extremely important: going through all these query layers // has non-negligible overhead even if the final result ends up being nothing, and our // number of queries for a frame grows linearly with the number of entity paths. - let component_names = component_names.into_iter().filter(|component_name| { - store.entity_has_component_on_timeline(&query.timeline(), entity_path, component_name) + let component_names = component_descrs.into_iter().filter_map(|component_descr| { + let component_descr = component_descr.into(); + store + .entity_has_component_on_timeline( + &query.timeline(), + entity_path, + &component_descr.component_name, + ) + .then_some(component_descr.component_name) }); for component_name in component_names { diff --git a/crates/store/re_query/tests/latest_at.rs b/crates/store/re_query/tests/latest_at.rs index 9cafc5a8efada..79ccca3e957fa 100644 --- a/crates/store/re_query/tests/latest_at.rs +++ b/crates/store/re_query/tests/latest_at.rs @@ -558,11 +558,7 @@ fn query_and_compare( re_log::setup_logging(); for _ in 0..3 { - let cached = caches.latest_at( - query, - entity_path, - MyPoints::all_components().iter().copied(), - ); + let cached = caches.latest_at(query, entity_path, MyPoints::all_components().iter()); let cached_points = cached.component_batch::().unwrap(); let cached_colors = cached.component_batch::().unwrap_or_default(); diff --git a/crates/store/re_query/tests/range.rs b/crates/store/re_query/tests/range.rs index d8b9313d6b5ca..472fe47e84935 100644 --- a/crates/store/re_query/tests/range.rs +++ b/crates/store/re_query/tests/range.rs @@ -891,11 +891,7 @@ fn concurrent_multitenant_edge_case() { eprintln!("{store}"); { - let cached = caches.range( - &query, - &entity_path, - MyPoints::all_components().iter().copied(), - ); + let cached = caches.range(&query, &entity_path, MyPoints::all_components().iter()); let _cached_all_points = cached.get_required(&MyPoint::name()).unwrap(); } @@ -969,11 +965,7 @@ fn concurrent_multitenant_edge_case2() { let query1 = RangeQuery::new(timepoint1[0].0, ResolvedTimeRange::new(123, 223)); { - let cached = caches.range( - &query1, - &entity_path, - MyPoints::all_components().iter().copied(), - ); + let cached = caches.range(&query1, &entity_path, MyPoints::all_components().iter()); let _cached_all_points = cached.get_required(&MyPoint::name()).unwrap(); } @@ -982,11 +974,7 @@ fn concurrent_multitenant_edge_case2() { let query2 = RangeQuery::new(timepoint1[0].0, ResolvedTimeRange::new(423, 523)); { - let cached = caches.range( - &query2, - &entity_path, - MyPoints::all_components().iter().copied(), - ); + let cached = caches.range(&query2, &entity_path, MyPoints::all_components().iter()); let _cached_all_points = cached.get_required(&MyPoint::name()).unwrap(); } @@ -1077,11 +1065,7 @@ fn query_and_compare( re_log::setup_logging(); for _ in 0..3 { - let cached = caches.range( - query, - entity_path, - MyPoints::all_components().iter().copied(), - ); + let cached = caches.range(query, entity_path, MyPoints::all_components().iter()); let all_points_chunks = cached.get_required(&MyPoint::name()).unwrap(); let all_points_indexed = all_points_chunks diff --git a/crates/store/re_types/src/archetypes/annotation_context.rs b/crates/store/re_types/src/archetypes/annotation_context.rs index 22bbd20e15081..d0089af3774aa 100644 --- a/crates/store/re_types/src/archetypes/annotation_context.rs +++ b/crates/store/re_types/src/archetypes/annotation_context.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The annotation context provides additional information on how to display entities. @@ -75,32 +75,40 @@ pub struct AnnotationContext { pub context: crate::components::AnnotationContext, } -impl ::re_types_core::SizeBytes for AnnotationContext { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.context.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.AnnotationContext".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AnnotationContext".into()), + component_name: "rerun.components.AnnotationContext".into(), + archetype_field_name: Some("context".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.AnnotationContextIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AnnotationContext".into()), + component_name: "AnnotationContextIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.AnnotationContext".into(), - "rerun.components.AnnotationContextIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AnnotationContext".into()), + component_name: "rerun.components.AnnotationContext".into(), + archetype_field_name: Some("context".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AnnotationContext".into()), + component_name: "AnnotationContextIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -128,26 +136,26 @@ impl ::re_types_core::Archetype for AnnotationContext { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: AnnotationContextIndicator = AnnotationContextIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -184,7 +192,16 @@ impl ::re_types_core::AsComponents for AnnotationContext { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.context as &dyn ComponentBatch).into()), + (Some(&self.context as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AnnotationContext".into()), + archetype_field_name: Some(("context").into()), + component_name: ("rerun.components.AnnotationContext").into(), + }), + } + }), ] .into_iter() .flatten() @@ -203,3 +220,15 @@ impl AnnotationContext { } } } + +impl ::re_types_core::SizeBytes for AnnotationContext { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.context.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/arrows2d.rs b/crates/store/re_types/src/archetypes/arrows2d.rs index 61b91af0fbe5a..c65e61ff69578 100644 --- a/crates/store/re_types/src/archetypes/arrows2d.rs +++ b/crates/store/re_types/src/archetypes/arrows2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: 2D arrows with optional colors, radii, labels, etc. @@ -87,67 +87,115 @@ pub struct Arrows2D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for Arrows2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.vectors.heap_size_bytes() - + self.origins.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.draw_order.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Vector2D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Vector2D".into(), + archetype_field_name: Some("vectors".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Position2D".into(), - "rerun.components.Arrows2DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("origins".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "Arrows2DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.DrawOrder".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Vector2D".into(), - "rerun.components.Position2D".into(), - "rerun.components.Arrows2DIndicator".into(), - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.DrawOrder".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Vector2D".into(), + archetype_field_name: Some("vectors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("origins".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "Arrows2DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -175,26 +223,26 @@ impl ::re_types_core::Archetype for Arrows2D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Arrows2DIndicator = Arrows2DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -317,28 +365,100 @@ impl ::re_types_core::AsComponents for Arrows2D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.vectors as &dyn ComponentBatch).into()), - self.origins + (Some(&self.vectors as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + archetype_field_name: Some(("vectors").into()), + component_name: ("rerun.components.Vector2D").into(), + }), + } + }), + (self + .origins .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.radii + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + archetype_field_name: Some(("origins").into()), + component_name: ("rerun.components.Position2D").into(), + }), + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.draw_order + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .draw_order .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + archetype_field_name: Some(("draw_order").into()), + component_name: ("rerun.components.DrawOrder").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows2D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -445,3 +565,29 @@ impl Arrows2D { self } } + +impl ::re_types_core::SizeBytes for Arrows2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.vectors.heap_size_bytes() + + self.origins.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.draw_order.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/arrows3d.rs b/crates/store/re_types/src/archetypes/arrows3d.rs index fca47c39aacd0..f846ccb71d02e 100644 --- a/crates/store/re_types/src/archetypes/arrows3d.rs +++ b/crates/store/re_types/src/archetypes/arrows3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: 3D arrows with optional colors, radii, labels, etc. @@ -95,63 +95,105 @@ pub struct Arrows3D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for Arrows3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.vectors.heap_size_bytes() - + self.origins.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Vector3D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Vector3D".into(), + archetype_field_name: Some("vectors".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Position3D".into(), - "rerun.components.Arrows3DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Position3D".into(), + archetype_field_name: Some("origins".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "Arrows3DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Vector3D".into(), - "rerun.components.Position3D".into(), - "rerun.components.Arrows3DIndicator".into(), - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Vector3D".into(), + archetype_field_name: Some("vectors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Position3D".into(), + archetype_field_name: Some("origins".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "Arrows3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -179,26 +221,26 @@ impl ::re_types_core::Archetype for Arrows3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Arrows3DIndicator = Arrows3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -311,25 +353,88 @@ impl ::re_types_core::AsComponents for Arrows3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.vectors as &dyn ComponentBatch).into()), - self.origins + (Some(&self.vectors as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + archetype_field_name: Some(("vectors").into()), + component_name: ("rerun.components.Vector3D").into(), + }), + } + }), + (self + .origins .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.radii + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + archetype_field_name: Some(("origins").into()), + component_name: ("rerun.components.Position3D").into(), + }), + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Arrows3D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -426,3 +531,27 @@ impl Arrows3D { self } } + +impl ::re_types_core::SizeBytes for Arrows3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.vectors.heap_size_bytes() + + self.origins.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/asset3d.rs b/crates/store/re_types/src/archetypes/asset3d.rs index c52ee742ca051..d6540291d3491 100644 --- a/crates/store/re_types/src/archetypes/asset3d.rs +++ b/crates/store/re_types/src/archetypes/asset3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A prepacked 3D asset (`.gltf`, `.glb`, `.obj`, `.stl`, etc.). @@ -78,43 +78,63 @@ pub struct Asset3D { pub albedo_factor: Option, } -impl ::re_types_core::SizeBytes for Asset3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.blob.heap_size_bytes() - + self.media_type.heap_size_bytes() - + self.albedo_factor.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Blob".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + component_name: "rerun.components.Blob".into(), + archetype_field_name: Some("blob".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.MediaType".into(), - "rerun.components.Asset3DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + component_name: "rerun.components.MediaType".into(), + archetype_field_name: Some("media_type".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + component_name: "Asset3DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.AlbedoFactor".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + component_name: "rerun.components.AlbedoFactor".into(), + archetype_field_name: Some("albedo_factor".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Blob".into(), - "rerun.components.MediaType".into(), - "rerun.components.Asset3DIndicator".into(), - "rerun.components.AlbedoFactor".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + component_name: "rerun.components.Blob".into(), + archetype_field_name: Some("blob".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + component_name: "rerun.components.MediaType".into(), + archetype_field_name: Some("media_type".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + component_name: "Asset3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + component_name: "rerun.components.AlbedoFactor".into(), + archetype_field_name: Some("albedo_factor".into()), + }, ] }); @@ -142,26 +162,26 @@ impl ::re_types_core::Archetype for Asset3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Asset3DIndicator = Asset3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -221,13 +241,40 @@ impl ::re_types_core::AsComponents for Asset3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.blob as &dyn ComponentBatch).into()), - self.media_type + (Some(&self.blob as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + archetype_field_name: Some(("blob").into()), + component_name: ("rerun.components.Blob").into(), + }), + } + }), + (self + .media_type .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.albedo_factor + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + archetype_field_name: Some(("media_type").into()), + component_name: ("rerun.components.MediaType").into(), + }), + }), + (self + .albedo_factor .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Asset3D".into()), + archetype_field_name: Some(("albedo_factor").into()), + component_name: ("rerun.components.AlbedoFactor").into(), + }), + }), ] .into_iter() .flatten() @@ -277,3 +324,19 @@ impl Asset3D { self } } + +impl ::re_types_core::SizeBytes for Asset3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.blob.heap_size_bytes() + + self.media_type.heap_size_bytes() + + self.albedo_factor.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/asset_video.rs b/crates/store/re_types/src/archetypes/asset_video.rs index 9e6411aac9ce9..9fc1a244f37bb 100644 --- a/crates/store/re_types/src/archetypes/asset_video.rs +++ b/crates/store/re_types/src/archetypes/asset_video.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A video binary. @@ -139,38 +139,52 @@ pub struct AssetVideo { pub media_type: Option, } -impl ::re_types_core::SizeBytes for AssetVideo { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.blob.heap_size_bytes() + self.media_type.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Blob".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AssetVideo".into()), + component_name: "rerun.components.Blob".into(), + archetype_field_name: Some("blob".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.MediaType".into(), - "rerun.components.AssetVideoIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AssetVideo".into()), + component_name: "rerun.components.MediaType".into(), + archetype_field_name: Some("media_type".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AssetVideo".into()), + component_name: "AssetVideoIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Blob".into(), - "rerun.components.MediaType".into(), - "rerun.components.AssetVideoIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AssetVideo".into()), + component_name: "rerun.components.Blob".into(), + archetype_field_name: Some("blob".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AssetVideo".into()), + component_name: "rerun.components.MediaType".into(), + archetype_field_name: Some("media_type".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AssetVideo".into()), + component_name: "AssetVideoIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -198,26 +212,26 @@ impl ::re_types_core::Archetype for AssetVideo { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: AssetVideoIndicator = AssetVideoIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -263,10 +277,28 @@ impl ::re_types_core::AsComponents for AssetVideo { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.blob as &dyn ComponentBatch).into()), - self.media_type + (Some(&self.blob as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AssetVideo".into()), + archetype_field_name: Some(("blob").into()), + component_name: ("rerun.components.Blob").into(), + }), + } + }), + (self + .media_type .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.AssetVideo".into()), + archetype_field_name: Some(("media_type").into()), + component_name: ("rerun.components.MediaType").into(), + }), + }), ] .into_iter() .flatten() @@ -299,3 +331,15 @@ impl AssetVideo { self } } + +impl ::re_types_core::SizeBytes for AssetVideo { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.blob.heap_size_bytes() + self.media_type.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/bar_chart.rs b/crates/store/re_types/src/archetypes/bar_chart.rs index caebaadf295ec..8d981c9fc06da 100644 --- a/crates/store/re_types/src/archetypes/bar_chart.rs +++ b/crates/store/re_types/src/archetypes/bar_chart.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A bar chart. @@ -55,33 +55,51 @@ pub struct BarChart { pub color: Option, } -impl ::re_types_core::SizeBytes for BarChart { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.values.heap_size_bytes() + self.color.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.TensorData".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.BarChart".into()), + component_name: "rerun.components.TensorData".into(), + archetype_field_name: Some("values".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.BarChartIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.BarChart".into()), + component_name: "BarChartIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Color".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.BarChart".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.TensorData".into(), - "rerun.components.BarChartIndicator".into(), - "rerun.components.Color".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.BarChart".into()), + component_name: "rerun.components.TensorData".into(), + archetype_field_name: Some("values".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.BarChart".into()), + component_name: "BarChartIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.BarChart".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }, ] }); @@ -109,26 +127,26 @@ impl ::re_types_core::Archetype for BarChart { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: BarChartIndicator = BarChartIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -174,10 +192,28 @@ impl ::re_types_core::AsComponents for BarChart { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.values as &dyn ComponentBatch).into()), - self.color + (Some(&self.values as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.BarChart".into()), + archetype_field_name: Some(("values").into()), + component_name: ("rerun.components.TensorData").into(), + }), + } + }), + (self + .color .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.BarChart".into()), + archetype_field_name: Some(("color").into()), + component_name: ("rerun.components.Color").into(), + }), + }), ] .into_iter() .flatten() @@ -204,3 +240,15 @@ impl BarChart { self } } + +impl ::re_types_core::SizeBytes for BarChart { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.values.heap_size_bytes() + self.color.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/boxes2d.rs b/crates/store/re_types/src/archetypes/boxes2d.rs index 7066ac700d395..847577d8d9314 100644 --- a/crates/store/re_types/src/archetypes/boxes2d.rs +++ b/crates/store/re_types/src/archetypes/boxes2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: 2D boxes with half-extents and optional center, colors etc. @@ -80,67 +80,115 @@ pub struct Boxes2D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for Boxes2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.half_sizes.heap_size_bytes() - + self.centers.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.draw_order.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.HalfSize2D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.HalfSize2D".into(), + archetype_field_name: Some("half_sizes".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Position2D".into(), - "rerun.components.Color".into(), - "rerun.components.Boxes2DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("centers".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "Boxes2DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.DrawOrder".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.HalfSize2D".into(), - "rerun.components.Position2D".into(), - "rerun.components.Color".into(), - "rerun.components.Boxes2DIndicator".into(), - "rerun.components.Radius".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.DrawOrder".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.HalfSize2D".into(), + archetype_field_name: Some("half_sizes".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("centers".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "Boxes2DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -168,26 +216,26 @@ impl ::re_types_core::Archetype for Boxes2D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Boxes2DIndicator = Boxes2DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -310,28 +358,100 @@ impl ::re_types_core::AsComponents for Boxes2D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.half_sizes as &dyn ComponentBatch).into()), - self.centers + (Some(&self.half_sizes as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + archetype_field_name: Some(("half_sizes").into()), + component_name: ("rerun.components.HalfSize2D").into(), + }), + } + }), + (self + .centers .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + archetype_field_name: Some(("centers").into()), + component_name: ("rerun.components.Position2D").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.radii + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.draw_order + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .draw_order .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + archetype_field_name: Some(("draw_order").into()), + component_name: ("rerun.components.DrawOrder").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes2D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -435,3 +555,29 @@ impl Boxes2D { self } } + +impl ::re_types_core::SizeBytes for Boxes2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.half_sizes.heap_size_bytes() + + self.centers.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.draw_order.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/boxes3d.rs b/crates/store/re_types/src/archetypes/boxes3d.rs index 180810e27f8ca..e1d7bdbd80443 100644 --- a/crates/store/re_types/src/archetypes/boxes3d.rs +++ b/crates/store/re_types/src/archetypes/boxes3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: 3D boxes with half-extents and optional center, rotations, colors etc. @@ -110,75 +110,135 @@ pub struct Boxes3D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for Boxes3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.half_sizes.heap_size_bytes() - + self.centers.heap_size_bytes() - + self.rotation_axis_angles.heap_size_bytes() - + self.quaternions.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.fill_mode.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.HalfSize3D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.HalfSize3D".into(), + archetype_field_name: Some("half_sizes".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.PoseTranslation3D".into(), - "rerun.components.Color".into(), - "rerun.components.Boxes3DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.PoseTranslation3D".into(), + archetype_field_name: Some("centers".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "Boxes3DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.PoseRotationAxisAngle".into(), - "rerun.components.PoseRotationQuat".into(), - "rerun.components.Radius".into(), - "rerun.components.FillMode".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.PoseRotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angles".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.PoseRotationQuat".into(), + archetype_field_name: Some("quaternions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.FillMode".into(), + archetype_field_name: Some("fill_mode".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 11usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 11usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.HalfSize3D".into(), - "rerun.components.PoseTranslation3D".into(), - "rerun.components.Color".into(), - "rerun.components.Boxes3DIndicator".into(), - "rerun.components.PoseRotationAxisAngle".into(), - "rerun.components.PoseRotationQuat".into(), - "rerun.components.Radius".into(), - "rerun.components.FillMode".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.HalfSize3D".into(), + archetype_field_name: Some("half_sizes".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.PoseTranslation3D".into(), + archetype_field_name: Some("centers".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "Boxes3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.PoseRotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angles".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.PoseRotationQuat".into(), + archetype_field_name: Some("quaternions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.FillMode".into(), + archetype_field_name: Some("fill_mode".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -206,26 +266,26 @@ impl ::re_types_core::Archetype for Boxes3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Boxes3DIndicator = Boxes3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -377,34 +437,124 @@ impl ::re_types_core::AsComponents for Boxes3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.half_sizes as &dyn ComponentBatch).into()), - self.centers + (Some(&self.half_sizes as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("half_sizes").into()), + component_name: ("rerun.components.HalfSize3D").into(), + }), + } + }), + (self + .centers .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.rotation_axis_angles + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("centers").into()), + component_name: ("rerun.components.PoseTranslation3D").into(), + }), + }), + (self + .rotation_axis_angles .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.quaternions + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("rotation_axis_angles").into()), + component_name: ("rerun.components.PoseRotationAxisAngle").into(), + }), + }), + (self + .quaternions .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("quaternions").into()), + component_name: ("rerun.components.PoseRotationQuat").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.radii + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fill_mode + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .fill_mode .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.labels + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("fill_mode").into()), + component_name: ("rerun.components.FillMode").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Boxes3D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -538,3 +688,33 @@ impl Boxes3D { self } } + +impl ::re_types_core::SizeBytes for Boxes3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.half_sizes.heap_size_bytes() + + self.centers.heap_size_bytes() + + self.rotation_axis_angles.heap_size_bytes() + + self.quaternions.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.fill_mode.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/capsules3d.rs b/crates/store/re_types/src/archetypes/capsules3d.rs index 43125d119b810..58b78acd12d96 100644 --- a/crates/store/re_types/src/archetypes/capsules3d.rs +++ b/crates/store/re_types/src/archetypes/capsules3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: 3D capsules; cylinders with hemispherical caps. @@ -112,75 +112,127 @@ pub struct Capsules3D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for Capsules3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.lengths.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.translations.heap_size_bytes() - + self.rotation_axis_angles.heap_size_bytes() - + self.quaternions.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Length".into(), - "rerun.components.Radius".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.Length".into(), + archetype_field_name: Some("lengths".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, ] }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.PoseTranslation3D".into(), - "rerun.components.Color".into(), - "rerun.components.Capsules3DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.PoseTranslation3D".into(), + archetype_field_name: Some("translations".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "Capsules3DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.PoseRotationAxisAngle".into(), - "rerun.components.PoseRotationQuat".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.PoseRotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angles".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.PoseRotationQuat".into(), + archetype_field_name: Some("quaternions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 10usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 10usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Length".into(), - "rerun.components.Radius".into(), - "rerun.components.PoseTranslation3D".into(), - "rerun.components.Color".into(), - "rerun.components.Capsules3DIndicator".into(), - "rerun.components.PoseRotationAxisAngle".into(), - "rerun.components.PoseRotationQuat".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.Length".into(), + archetype_field_name: Some("lengths".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.PoseTranslation3D".into(), + archetype_field_name: Some("translations".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "Capsules3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.PoseRotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angles".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.PoseRotationQuat".into(), + archetype_field_name: Some("quaternions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -208,26 +260,26 @@ impl ::re_types_core::Archetype for Capsules3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Capsules3DIndicator = Capsules3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -369,29 +421,110 @@ impl ::re_types_core::AsComponents for Capsules3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.lengths as &dyn ComponentBatch).into()), - Some((&self.radii as &dyn ComponentBatch).into()), - self.translations + (Some(&self.lengths as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("lengths").into()), + component_name: ("rerun.components.Length").into(), + }), + } + }), + (Some(&self.radii as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + } + }), + (self + .translations .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.rotation_axis_angles + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("translations").into()), + component_name: ("rerun.components.PoseTranslation3D").into(), + }), + }), + (self + .rotation_axis_angles .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.quaternions + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("rotation_axis_angles").into()), + component_name: ("rerun.components.PoseRotationAxisAngle").into(), + }), + }), + (self + .quaternions .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("quaternions").into()), + component_name: ("rerun.components.PoseRotationQuat").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Capsules3D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -505,3 +638,31 @@ impl Capsules3D { self } } + +impl ::re_types_core::SizeBytes for Capsules3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.lengths.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.translations.heap_size_bytes() + + self.rotation_axis_angles.heap_size_bytes() + + self.quaternions.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/depth_image.rs b/crates/store/re_types/src/archetypes/depth_image.rs index 42f82815f263f..3e44a4d6ea823 100644 --- a/crates/store/re_types/src/archetypes/depth_image.rs +++ b/crates/store/re_types/src/archetypes/depth_image.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A depth image, i.e. as captured by a depth camera. @@ -114,63 +114,105 @@ pub struct DepthImage { pub draw_order: Option, } -impl ::re_types_core::SizeBytes for DepthImage { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.buffer.heap_size_bytes() - + self.format.heap_size_bytes() - + self.meter.heap_size_bytes() - + self.colormap.heap_size_bytes() - + self.depth_range.heap_size_bytes() - + self.point_fill_ratio.heap_size_bytes() - + self.draw_order.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ImageBuffer".into(), - "rerun.components.ImageFormat".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.ImageBuffer".into(), + archetype_field_name: Some("buffer".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.ImageFormat".into(), + archetype_field_name: Some("format".into()), + }, ] }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.DepthImageIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "DepthImageIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.DepthMeter".into(), - "rerun.components.Colormap".into(), - "rerun.components.ValueRange".into(), - "rerun.components.FillRatio".into(), - "rerun.components.DrawOrder".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.DepthMeter".into(), + archetype_field_name: Some("meter".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.Colormap".into(), + archetype_field_name: Some("colormap".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.ValueRange".into(), + archetype_field_name: Some("depth_range".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.FillRatio".into(), + archetype_field_name: Some("point_fill_ratio".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ImageBuffer".into(), - "rerun.components.ImageFormat".into(), - "rerun.components.DepthImageIndicator".into(), - "rerun.components.DepthMeter".into(), - "rerun.components.Colormap".into(), - "rerun.components.ValueRange".into(), - "rerun.components.FillRatio".into(), - "rerun.components.DrawOrder".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.ImageBuffer".into(), + archetype_field_name: Some("buffer".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.ImageFormat".into(), + archetype_field_name: Some("format".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "DepthImageIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.DepthMeter".into(), + archetype_field_name: Some("meter".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.Colormap".into(), + archetype_field_name: Some("colormap".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.ValueRange".into(), + archetype_field_name: Some("depth_range".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.FillRatio".into(), + archetype_field_name: Some("point_fill_ratio".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, ] }); @@ -198,26 +240,26 @@ impl ::re_types_core::Archetype for DepthImage { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: DepthImageIndicator = DepthImageIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -321,23 +363,86 @@ impl ::re_types_core::AsComponents for DepthImage { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.buffer as &dyn ComponentBatch).into()), - Some((&self.format as &dyn ComponentBatch).into()), - self.meter + (Some(&self.buffer as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + archetype_field_name: Some(("buffer").into()), + component_name: ("rerun.components.ImageBuffer").into(), + }), + } + }), + (Some(&self.format as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + archetype_field_name: Some(("format").into()), + component_name: ("rerun.components.ImageFormat").into(), + }), + } + }), + (self + .meter .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.colormap + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + archetype_field_name: Some(("meter").into()), + component_name: ("rerun.components.DepthMeter").into(), + }), + }), + (self + .colormap .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.depth_range + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + archetype_field_name: Some(("colormap").into()), + component_name: ("rerun.components.Colormap").into(), + }), + }), + (self + .depth_range .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.point_fill_ratio + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + archetype_field_name: Some(("depth_range").into()), + component_name: ("rerun.components.ValueRange").into(), + }), + }), + (self + .point_fill_ratio .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.draw_order + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + archetype_field_name: Some(("point_fill_ratio").into()), + component_name: ("rerun.components.FillRatio").into(), + }), + }), + (self + .draw_order .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DepthImage".into()), + archetype_field_name: Some(("draw_order").into()), + component_name: ("rerun.components.DrawOrder").into(), + }), + }), ] .into_iter() .flatten() @@ -432,3 +537,27 @@ impl DepthImage { self } } + +impl ::re_types_core::SizeBytes for DepthImage { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.buffer.heap_size_bytes() + + self.format.heap_size_bytes() + + self.meter.heap_size_bytes() + + self.colormap.heap_size_bytes() + + self.depth_range.heap_size_bytes() + + self.point_fill_ratio.heap_size_bytes() + + self.draw_order.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && ::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/disconnected_space.rs b/crates/store/re_types/src/archetypes/disconnected_space.rs index e3308b01372b1..e6de0f995fc11 100644 --- a/crates/store/re_types/src/archetypes/disconnected_space.rs +++ b/crates/store/re_types/src/archetypes/disconnected_space.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Spatially disconnect this entity from its parent. @@ -67,32 +67,40 @@ pub struct DisconnectedSpace { pub disconnected_space: crate::components::DisconnectedSpace, } -impl ::re_types_core::SizeBytes for DisconnectedSpace { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.disconnected_space.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.DisconnectedSpace".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DisconnectedSpace".into()), + component_name: "rerun.components.DisconnectedSpace".into(), + archetype_field_name: Some("disconnected_space".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.DisconnectedSpaceIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DisconnectedSpace".into()), + component_name: "DisconnectedSpaceIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.DisconnectedSpace".into(), - "rerun.components.DisconnectedSpaceIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DisconnectedSpace".into()), + component_name: "rerun.components.DisconnectedSpace".into(), + archetype_field_name: Some("disconnected_space".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DisconnectedSpace".into()), + component_name: "DisconnectedSpaceIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -120,26 +128,26 @@ impl ::re_types_core::Archetype for DisconnectedSpace { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: DisconnectedSpaceIndicator = DisconnectedSpaceIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -176,7 +184,16 @@ impl ::re_types_core::AsComponents for DisconnectedSpace { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.disconnected_space as &dyn ComponentBatch).into()), + (Some(&self.disconnected_space as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.DisconnectedSpace".into()), + archetype_field_name: Some(("disconnected_space").into()), + component_name: ("rerun.components.DisconnectedSpace").into(), + }), + } + }), ] .into_iter() .flatten() @@ -195,3 +212,15 @@ impl DisconnectedSpace { } } } + +impl ::re_types_core::SizeBytes for DisconnectedSpace { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.disconnected_space.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/ellipsoids3d.rs b/crates/store/re_types/src/archetypes/ellipsoids3d.rs index 2293bfa84f399..fa4d0085c550a 100644 --- a/crates/store/re_types/src/archetypes/ellipsoids3d.rs +++ b/crates/store/re_types/src/archetypes/ellipsoids3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: 3D ellipsoids or spheres. @@ -73,75 +73,135 @@ pub struct Ellipsoids3D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for Ellipsoids3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.half_sizes.heap_size_bytes() - + self.centers.heap_size_bytes() - + self.rotation_axis_angles.heap_size_bytes() - + self.quaternions.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.line_radii.heap_size_bytes() - + self.fill_mode.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.HalfSize3D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.HalfSize3D".into(), + archetype_field_name: Some("half_sizes".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.PoseTranslation3D".into(), - "rerun.components.Color".into(), - "rerun.components.Ellipsoids3DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.PoseTranslation3D".into(), + archetype_field_name: Some("centers".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "Ellipsoids3DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.PoseRotationAxisAngle".into(), - "rerun.components.PoseRotationQuat".into(), - "rerun.components.Radius".into(), - "rerun.components.FillMode".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.PoseRotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angles".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.PoseRotationQuat".into(), + archetype_field_name: Some("quaternions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("line_radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.FillMode".into(), + archetype_field_name: Some("fill_mode".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 11usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 11usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.HalfSize3D".into(), - "rerun.components.PoseTranslation3D".into(), - "rerun.components.Color".into(), - "rerun.components.Ellipsoids3DIndicator".into(), - "rerun.components.PoseRotationAxisAngle".into(), - "rerun.components.PoseRotationQuat".into(), - "rerun.components.Radius".into(), - "rerun.components.FillMode".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.HalfSize3D".into(), + archetype_field_name: Some("half_sizes".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.PoseTranslation3D".into(), + archetype_field_name: Some("centers".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "Ellipsoids3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.PoseRotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angles".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.PoseRotationQuat".into(), + archetype_field_name: Some("quaternions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("line_radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.FillMode".into(), + archetype_field_name: Some("fill_mode".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -169,26 +229,26 @@ impl ::re_types_core::Archetype for Ellipsoids3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Ellipsoids3DIndicator = Ellipsoids3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -340,34 +400,124 @@ impl ::re_types_core::AsComponents for Ellipsoids3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.half_sizes as &dyn ComponentBatch).into()), - self.centers + (Some(&self.half_sizes as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("half_sizes").into()), + component_name: ("rerun.components.HalfSize3D").into(), + }), + } + }), + (self + .centers .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.rotation_axis_angles + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("centers").into()), + component_name: ("rerun.components.PoseTranslation3D").into(), + }), + }), + (self + .rotation_axis_angles .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.quaternions + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("rotation_axis_angles").into()), + component_name: ("rerun.components.PoseRotationAxisAngle").into(), + }), + }), + (self + .quaternions .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("quaternions").into()), + component_name: ("rerun.components.PoseRotationQuat").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.line_radii + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .line_radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fill_mode + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("line_radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .fill_mode .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.labels + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("fill_mode").into()), + component_name: ("rerun.components.FillMode").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -498,3 +648,33 @@ impl Ellipsoids3D { self } } + +impl ::re_types_core::SizeBytes for Ellipsoids3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.half_sizes.heap_size_bytes() + + self.centers.heap_size_bytes() + + self.rotation_axis_angles.heap_size_bytes() + + self.quaternions.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.line_radii.heap_size_bytes() + + self.fill_mode.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/encoded_image.rs b/crates/store/re_types/src/archetypes/encoded_image.rs index ea5bff668cd72..1bc3f1ecb79dc 100644 --- a/crates/store/re_types/src/archetypes/encoded_image.rs +++ b/crates/store/re_types/src/archetypes/encoded_image.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: An image encoded as e.g. a JPEG or PNG. @@ -66,51 +66,75 @@ pub struct EncodedImage { pub draw_order: Option, } -impl ::re_types_core::SizeBytes for EncodedImage { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.blob.heap_size_bytes() - + self.media_type.heap_size_bytes() - + self.opacity.heap_size_bytes() - + self.draw_order.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Blob".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "rerun.components.Blob".into(), + archetype_field_name: Some("blob".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.MediaType".into(), - "rerun.components.EncodedImageIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "rerun.components.MediaType".into(), + archetype_field_name: Some("media_type".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "EncodedImageIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Opacity".into(), - "rerun.components.DrawOrder".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "rerun.components.Opacity".into(), + archetype_field_name: Some("opacity".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Blob".into(), - "rerun.components.MediaType".into(), - "rerun.components.EncodedImageIndicator".into(), - "rerun.components.Opacity".into(), - "rerun.components.DrawOrder".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "rerun.components.Blob".into(), + archetype_field_name: Some("blob".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "rerun.components.MediaType".into(), + archetype_field_name: Some("media_type".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "EncodedImageIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "rerun.components.Opacity".into(), + archetype_field_name: Some("opacity".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, ] }); @@ -138,26 +162,26 @@ impl ::re_types_core::Archetype for EncodedImage { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: EncodedImageIndicator = EncodedImageIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -226,16 +250,52 @@ impl ::re_types_core::AsComponents for EncodedImage { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.blob as &dyn ComponentBatch).into()), - self.media_type + (Some(&self.blob as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + archetype_field_name: Some(("blob").into()), + component_name: ("rerun.components.Blob").into(), + }), + } + }), + (self + .media_type .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.opacity + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + archetype_field_name: Some(("media_type").into()), + component_name: ("rerun.components.MediaType").into(), + }), + }), + (self + .opacity .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.draw_order + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + archetype_field_name: Some(("opacity").into()), + component_name: ("rerun.components.Opacity").into(), + }), + }), + (self + .draw_order .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.EncodedImage".into()), + archetype_field_name: Some(("draw_order").into()), + component_name: ("rerun.components.DrawOrder").into(), + }), + }), ] .into_iter() .flatten() @@ -289,3 +349,21 @@ impl EncodedImage { self } } + +impl ::re_types_core::SizeBytes for EncodedImage { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.blob.heap_size_bytes() + + self.media_type.heap_size_bytes() + + self.opacity.heap_size_bytes() + + self.draw_order.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/geo_line_strings.rs b/crates/store/re_types/src/archetypes/geo_line_strings.rs index 5604428809774..c6ec6bcc6d99f 100644 --- a/crates/store/re_types/src/archetypes/geo_line_strings.rs +++ b/crates/store/re_types/src/archetypes/geo_line_strings.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Geospatial line strings with positions expressed in [EPSG:4326](https://epsg.io/4326) altitude and longitude (North/East-positive degrees), and optional colors and radii. @@ -69,44 +69,62 @@ pub struct GeoLineStrings { pub colors: Option>, } -impl ::re_types_core::SizeBytes for GeoLineStrings { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.line_strings.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.colors.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.GeoLineString".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + component_name: "rerun.components.GeoLineString".into(), + archetype_field_name: Some("line_strings".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.GeoLineStringsIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + component_name: "GeoLineStringsIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.GeoLineString".into(), - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.GeoLineStringsIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + component_name: "rerun.components.GeoLineString".into(), + archetype_field_name: Some("line_strings".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + component_name: "GeoLineStringsIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -134,26 +152,26 @@ impl ::re_types_core::Archetype for GeoLineStrings { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: GeoLineStringsIndicator = GeoLineStringsIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -217,13 +235,40 @@ impl ::re_types_core::AsComponents for GeoLineStrings { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.line_strings as &dyn ComponentBatch).into()), - self.radii + (Some(&self.line_strings as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + archetype_field_name: Some(("line_strings").into()), + component_name: ("rerun.components.GeoLineString").into(), + }), + } + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), ] .into_iter() .flatten() @@ -269,3 +314,19 @@ impl GeoLineStrings { self } } + +impl ::re_types_core::SizeBytes for GeoLineStrings { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.line_strings.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.colors.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/geo_points.rs b/crates/store/re_types/src/archetypes/geo_points.rs index 500c7e8d4a2dd..bb3fc85efb0a6 100644 --- a/crates/store/re_types/src/archetypes/geo_points.rs +++ b/crates/store/re_types/src/archetypes/geo_points.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Geospatial points with positions expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees), and optional colors and radii. @@ -65,47 +65,73 @@ pub struct GeoPoints { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for GeoPoints { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.positions.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.LatLon".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "rerun.components.LatLon".into(), + archetype_field_name: Some("positions".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.GeoPointsIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "GeoPointsIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.ClassId".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.LatLon".into(), - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.GeoPointsIndicator".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "rerun.components.LatLon".into(), + archetype_field_name: Some("positions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "GeoPointsIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -133,26 +159,26 @@ impl ::re_types_core::Archetype for GeoPoints { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: GeoPointsIndicator = GeoPointsIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -229,16 +255,52 @@ impl ::re_types_core::AsComponents for GeoPoints { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.positions as &dyn ComponentBatch).into()), - self.radii + (Some(&self.positions as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + archetype_field_name: Some(("positions").into()), + component_name: ("rerun.components.LatLon").into(), + }), + } + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GeoPoints".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -296,3 +358,21 @@ impl GeoPoints { self } } + +impl ::re_types_core::SizeBytes for GeoPoints { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.positions.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/graph_edges.rs b/crates/store/re_types/src/archetypes/graph_edges.rs index 73b5ede6aa783..7f2a7b7a8c363 100644 --- a/crates/store/re_types/src/archetypes/graph_edges.rs +++ b/crates/store/re_types/src/archetypes/graph_edges.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A list of edges in a graph. @@ -34,39 +34,52 @@ pub struct GraphEdges { pub graph_type: Option, } -impl ::re_types_core::SizeBytes for GraphEdges { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.edges.heap_size_bytes() + self.graph_type.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.GraphEdge".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphEdges".into()), + component_name: "rerun.components.GraphEdge".into(), + archetype_field_name: Some("edges".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.GraphType".into(), - "rerun.components.GraphEdgesIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphEdges".into()), + component_name: "rerun.components.GraphType".into(), + archetype_field_name: Some("graph_type".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphEdges".into()), + component_name: "GraphEdgesIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.GraphEdge".into(), - "rerun.components.GraphType".into(), - "rerun.components.GraphEdgesIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphEdges".into()), + component_name: "rerun.components.GraphEdge".into(), + archetype_field_name: Some("edges".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphEdges".into()), + component_name: "rerun.components.GraphType".into(), + archetype_field_name: Some("graph_type".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphEdges".into()), + component_name: "GraphEdgesIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -94,26 +107,26 @@ impl ::re_types_core::Archetype for GraphEdges { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: GraphEdgesIndicator = GraphEdgesIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -158,10 +171,28 @@ impl ::re_types_core::AsComponents for GraphEdges { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.edges as &dyn ComponentBatch).into()), - self.graph_type + (Some(&self.edges as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphEdges".into()), + archetype_field_name: Some(("edges").into()), + component_name: ("rerun.components.GraphEdge").into(), + }), + } + }), + (self + .graph_type .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphEdges".into()), + archetype_field_name: Some(("graph_type").into()), + component_name: ("rerun.components.GraphType").into(), + }), + }), ] .into_iter() .flatten() @@ -190,3 +221,16 @@ impl GraphEdges { self } } + +impl ::re_types_core::SizeBytes for GraphEdges { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.edges.heap_size_bytes() + self.graph_type.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/graph_nodes.rs b/crates/store/re_types/src/archetypes/graph_nodes.rs index 96e10bc1418d7..506208695045e 100644 --- a/crates/store/re_types/src/archetypes/graph_nodes.rs +++ b/crates/store/re_types/src/archetypes/graph_nodes.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A list of nodes in a graph with optional labels, colors, etc. @@ -42,55 +42,93 @@ pub struct GraphNodes { pub radii: Option>, } -impl ::re_types_core::SizeBytes for GraphNodes { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.node_ids.heap_size_bytes() - + self.positions.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.radii.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.GraphNode".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.GraphNode".into(), + archetype_field_name: Some("node_ids".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.GraphNodesIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "GraphNodesIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Position2D".into(), - "rerun.components.Color".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.Radius".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("positions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.GraphNode".into(), - "rerun.components.GraphNodesIndicator".into(), - "rerun.components.Position2D".into(), - "rerun.components.Color".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.Radius".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.GraphNode".into(), + archetype_field_name: Some("node_ids".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "GraphNodesIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("positions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, ] }); @@ -118,26 +156,26 @@ impl ::re_types_core::Archetype for GraphNodes { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: GraphNodesIndicator = GraphNodesIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -237,22 +275,76 @@ impl ::re_types_core::AsComponents for GraphNodes { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.node_ids as &dyn ComponentBatch).into()), - self.positions + (Some(&self.node_ids as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + archetype_field_name: Some(("node_ids").into()), + component_name: ("rerun.components.GraphNode").into(), + }), + } + }), + (self + .positions .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + archetype_field_name: Some(("positions").into()), + component_name: ("rerun.components.Position2D").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.radii + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.GraphNodes".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), ] .into_iter() .flatten() @@ -328,3 +420,25 @@ impl GraphNodes { self } } + +impl ::re_types_core::SizeBytes for GraphNodes { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.node_ids.heap_size_bytes() + + self.positions.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.radii.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/image.rs b/crates/store/re_types/src/archetypes/image.rs index 9b6c68978d091..7bdfb542073e0 100644 --- a/crates/store/re_types/src/archetypes/image.rs +++ b/crates/store/re_types/src/archetypes/image.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A monochrome or color image. @@ -145,51 +145,75 @@ pub struct Image { pub draw_order: Option, } -impl ::re_types_core::SizeBytes for Image { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.buffer.heap_size_bytes() - + self.format.heap_size_bytes() - + self.opacity.heap_size_bytes() - + self.draw_order.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ImageBuffer".into(), - "rerun.components.ImageFormat".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "rerun.components.ImageBuffer".into(), + archetype_field_name: Some("buffer".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "rerun.components.ImageFormat".into(), + archetype_field_name: Some("format".into()), + }, ] }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.ImageIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "ImageIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Opacity".into(), - "rerun.components.DrawOrder".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "rerun.components.Opacity".into(), + archetype_field_name: Some("opacity".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ImageBuffer".into(), - "rerun.components.ImageFormat".into(), - "rerun.components.ImageIndicator".into(), - "rerun.components.Opacity".into(), - "rerun.components.DrawOrder".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "rerun.components.ImageBuffer".into(), + archetype_field_name: Some("buffer".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "rerun.components.ImageFormat".into(), + archetype_field_name: Some("format".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "ImageIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "rerun.components.Opacity".into(), + archetype_field_name: Some("opacity".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, ] }); @@ -217,26 +241,26 @@ impl ::re_types_core::Archetype for Image { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: ImageIndicator = ImageIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -309,14 +333,50 @@ impl ::re_types_core::AsComponents for Image { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.buffer as &dyn ComponentBatch).into()), - Some((&self.format as &dyn ComponentBatch).into()), - self.opacity + (Some(&self.buffer as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + archetype_field_name: Some(("buffer").into()), + component_name: ("rerun.components.ImageBuffer").into(), + }), + } + }), + (Some(&self.format as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + archetype_field_name: Some(("format").into()), + component_name: ("rerun.components.ImageFormat").into(), + }), + } + }), + (self + .opacity .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.draw_order + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + archetype_field_name: Some(("opacity").into()), + component_name: ("rerun.components.Opacity").into(), + }), + }), + (self + .draw_order .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Image".into()), + archetype_field_name: Some(("draw_order").into()), + component_name: ("rerun.components.DrawOrder").into(), + }), + }), ] .into_iter() .flatten() @@ -359,3 +419,21 @@ impl Image { self } } + +impl ::re_types_core::SizeBytes for Image { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.buffer.heap_size_bytes() + + self.format.heap_size_bytes() + + self.opacity.heap_size_bytes() + + self.draw_order.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && ::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/instance_poses3d.rs b/crates/store/re_types/src/archetypes/instance_poses3d.rs index 0903a53dfb687..f52e632f95498 100644 --- a/crates/store/re_types/src/archetypes/instance_poses3d.rs +++ b/crates/store/re_types/src/archetypes/instance_poses3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: One or more transforms between the current entity and its parent. Unlike [`archetypes::Transform3D`][crate::archetypes::Transform3D], it is *not* propagated in the transform hierarchy. @@ -108,52 +108,82 @@ pub struct InstancePoses3D { pub mat3x3: Option>, } -impl ::re_types_core::SizeBytes for InstancePoses3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.translations.heap_size_bytes() - + self.rotation_axis_angles.heap_size_bytes() - + self.quaternions.heap_size_bytes() - + self.scales.heap_size_bytes() - + self.mat3x3.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstancePoses3DIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "InstancePoses3DIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.PoseTranslation3D".into(), - "rerun.components.PoseRotationAxisAngle".into(), - "rerun.components.PoseRotationQuat".into(), - "rerun.components.PoseScale3D".into(), - "rerun.components.PoseTransformMat3x3".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseTranslation3D".into(), + archetype_field_name: Some("translations".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseRotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angles".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseRotationQuat".into(), + archetype_field_name: Some("quaternions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseScale3D".into(), + archetype_field_name: Some("scales".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseTransformMat3x3".into(), + archetype_field_name: Some("mat3x3".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.InstancePoses3DIndicator".into(), - "rerun.components.PoseTranslation3D".into(), - "rerun.components.PoseRotationAxisAngle".into(), - "rerun.components.PoseRotationQuat".into(), - "rerun.components.PoseScale3D".into(), - "rerun.components.PoseTransformMat3x3".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "InstancePoses3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseTranslation3D".into(), + archetype_field_name: Some("translations".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseRotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angles".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseRotationQuat".into(), + archetype_field_name: Some("quaternions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseScale3D".into(), + archetype_field_name: Some("scales".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + component_name: "rerun.components.PoseTransformMat3x3".into(), + archetype_field_name: Some("mat3x3".into()), + }, ] }); @@ -181,26 +211,26 @@ impl ::re_types_core::Archetype for InstancePoses3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: InstancePoses3DIndicator = InstancePoses3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -294,21 +324,66 @@ impl ::re_types_core::AsComponents for InstancePoses3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.translations + (self + .translations .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.rotation_axis_angles + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + archetype_field_name: Some(("translations").into()), + component_name: ("rerun.components.PoseTranslation3D").into(), + }), + }), + (self + .rotation_axis_angles .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.quaternions + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + archetype_field_name: Some(("rotation_axis_angles").into()), + component_name: ("rerun.components.PoseRotationAxisAngle").into(), + }), + }), + (self + .quaternions .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.scales + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + archetype_field_name: Some(("quaternions").into()), + component_name: ("rerun.components.PoseRotationQuat").into(), + }), + }), + (self + .scales .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.mat3x3 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + archetype_field_name: Some(("scales").into()), + component_name: ("rerun.components.PoseScale3D").into(), + }), + }), + (self + .mat3x3 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), + archetype_field_name: Some(("mat3x3").into()), + component_name: ("rerun.components.PoseTransformMat3x3").into(), + }), + }), ] .into_iter() .flatten() @@ -384,3 +459,23 @@ impl InstancePoses3D { self } } + +impl ::re_types_core::SizeBytes for InstancePoses3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.translations.heap_size_bytes() + + self.rotation_axis_angles.heap_size_bytes() + + self.quaternions.heap_size_bytes() + + self.scales.heap_size_bytes() + + self.mat3x3.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/line_strips2d.rs b/crates/store/re_types/src/archetypes/line_strips2d.rs index 259ded243719b..b9fcc402b2eac 100644 --- a/crates/store/re_types/src/archetypes/line_strips2d.rs +++ b/crates/store/re_types/src/archetypes/line_strips2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: 2D line strips with positions and optional colors, radii, labels, etc. @@ -114,63 +114,105 @@ pub struct LineStrips2D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for LineStrips2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.strips.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.draw_order.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.LineStrip2D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.LineStrip2D".into(), + archetype_field_name: Some("strips".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.LineStrips2DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "LineStrips2DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.DrawOrder".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.LineStrip2D".into(), - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.LineStrips2DIndicator".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.DrawOrder".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.LineStrip2D".into(), + archetype_field_name: Some("strips".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "LineStrips2DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -198,26 +240,26 @@ impl ::re_types_core::Archetype for LineStrips2D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: LineStrips2DIndicator = LineStrips2DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -327,25 +369,88 @@ impl ::re_types_core::AsComponents for LineStrips2D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.strips as &dyn ComponentBatch).into()), - self.radii + (Some(&self.strips as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + archetype_field_name: Some(("strips").into()), + component_name: ("rerun.components.LineStrip2D").into(), + }), + } + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.draw_order + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .draw_order .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + archetype_field_name: Some(("draw_order").into()), + component_name: ("rerun.components.DrawOrder").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips2D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -436,3 +541,27 @@ impl LineStrips2D { self } } + +impl ::re_types_core::SizeBytes for LineStrips2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.strips.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.draw_order.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/line_strips3d.rs b/crates/store/re_types/src/archetypes/line_strips3d.rs index 0080beae7aec6..41d503709e2ee 100644 --- a/crates/store/re_types/src/archetypes/line_strips3d.rs +++ b/crates/store/re_types/src/archetypes/line_strips3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: 3D line strips with positions and optional colors, radii, labels, etc. @@ -124,59 +124,95 @@ pub struct LineStrips3D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for LineStrips3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.strips.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.LineStrip3D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.LineStrip3D".into(), + archetype_field_name: Some("strips".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.LineStrips3DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "LineStrips3DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.LineStrip3D".into(), - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.LineStrips3DIndicator".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.LineStrip3D".into(), + archetype_field_name: Some("strips".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "LineStrips3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -204,26 +240,26 @@ impl ::re_types_core::Archetype for LineStrips3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: LineStrips3DIndicator = LineStrips3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -323,22 +359,76 @@ impl ::re_types_core::AsComponents for LineStrips3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.strips as &dyn ComponentBatch).into()), - self.radii + (Some(&self.strips as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + archetype_field_name: Some(("strips").into()), + component_name: ("rerun.components.LineStrip3D").into(), + }), + } + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.LineStrips3D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -419,3 +509,25 @@ impl LineStrips3D { self } } + +impl ::re_types_core::SizeBytes for LineStrips3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.strips.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/mesh3d.rs b/crates/store/re_types/src/archetypes/mesh3d.rs index 46d78a5991916..206e713e7f494 100644 --- a/crates/store/re_types/src/archetypes/mesh3d.rs +++ b/crates/store/re_types/src/archetypes/mesh3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A 3D triangle mesh as specified by its per-mesh and per-vertex properties. @@ -145,71 +145,125 @@ pub struct Mesh3D { pub class_ids: Option>, } -impl ::re_types_core::SizeBytes for Mesh3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.vertex_positions.heap_size_bytes() - + self.triangle_indices.heap_size_bytes() - + self.vertex_normals.heap_size_bytes() - + self.vertex_colors.heap_size_bytes() - + self.vertex_texcoords.heap_size_bytes() - + self.albedo_factor.heap_size_bytes() - + self.albedo_texture_buffer.heap_size_bytes() - + self.albedo_texture_format.heap_size_bytes() - + self.class_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Position3D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.Position3D".into(), + archetype_field_name: Some("vertex_positions".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.TriangleIndices".into(), - "rerun.components.Vector3D".into(), - "rerun.components.Mesh3DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.TriangleIndices".into(), + archetype_field_name: Some("triangle_indices".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.Vector3D".into(), + archetype_field_name: Some("vertex_normals".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "Mesh3DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Color".into(), - "rerun.components.Texcoord2D".into(), - "rerun.components.AlbedoFactor".into(), - "rerun.components.ImageBuffer".into(), - "rerun.components.ImageFormat".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("vertex_colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.Texcoord2D".into(), + archetype_field_name: Some("vertex_texcoords".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.AlbedoFactor".into(), + archetype_field_name: Some("albedo_factor".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.ImageBuffer".into(), + archetype_field_name: Some("albedo_texture_buffer".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.ImageFormat".into(), + archetype_field_name: Some("albedo_texture_format".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 10usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 10usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Position3D".into(), - "rerun.components.TriangleIndices".into(), - "rerun.components.Vector3D".into(), - "rerun.components.Mesh3DIndicator".into(), - "rerun.components.Color".into(), - "rerun.components.Texcoord2D".into(), - "rerun.components.AlbedoFactor".into(), - "rerun.components.ImageBuffer".into(), - "rerun.components.ImageFormat".into(), - "rerun.components.ClassId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.Position3D".into(), + archetype_field_name: Some("vertex_positions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.TriangleIndices".into(), + archetype_field_name: Some("triangle_indices".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.Vector3D".into(), + archetype_field_name: Some("vertex_normals".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "Mesh3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("vertex_colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.Texcoord2D".into(), + archetype_field_name: Some("vertex_texcoords".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.AlbedoFactor".into(), + archetype_field_name: Some("albedo_factor".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.ImageBuffer".into(), + archetype_field_name: Some("albedo_texture_buffer".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.ImageFormat".into(), + archetype_field_name: Some("albedo_texture_format".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, ] }); @@ -237,26 +291,26 @@ impl ::re_types_core::Archetype for Mesh3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Mesh3DIndicator = Mesh3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -394,31 +448,112 @@ impl ::re_types_core::AsComponents for Mesh3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.vertex_positions as &dyn ComponentBatch).into()), - self.triangle_indices + (Some(&self.vertex_positions as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("vertex_positions").into()), + component_name: ("rerun.components.Position3D").into(), + }), + } + }), + (self + .triangle_indices .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.vertex_normals + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("triangle_indices").into()), + component_name: ("rerun.components.TriangleIndices").into(), + }), + }), + (self + .vertex_normals .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.vertex_colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("vertex_normals").into()), + component_name: ("rerun.components.Vector3D").into(), + }), + }), + (self + .vertex_colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.vertex_texcoords + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("vertex_colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .vertex_texcoords .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.albedo_factor + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("vertex_texcoords").into()), + component_name: ("rerun.components.Texcoord2D").into(), + }), + }), + (self + .albedo_factor .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.albedo_texture_buffer + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("albedo_factor").into()), + component_name: ("rerun.components.AlbedoFactor").into(), + }), + }), + (self + .albedo_texture_buffer .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.albedo_texture_format + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("albedo_texture_buffer").into()), + component_name: ("rerun.components.ImageBuffer").into(), + }), + }), + (self + .albedo_texture_format .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("albedo_texture_format").into()), + component_name: ("rerun.components.ImageFormat").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Mesh3D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), ] .into_iter() .flatten() @@ -534,3 +669,31 @@ impl Mesh3D { self } } + +impl ::re_types_core::SizeBytes for Mesh3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.vertex_positions.heap_size_bytes() + + self.triangle_indices.heap_size_bytes() + + self.vertex_normals.heap_size_bytes() + + self.vertex_colors.heap_size_bytes() + + self.vertex_texcoords.heap_size_bytes() + + self.albedo_factor.heap_size_bytes() + + self.albedo_texture_buffer.heap_size_bytes() + + self.albedo_texture_format.heap_size_bytes() + + self.class_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/pinhole.rs b/crates/store/re_types/src/archetypes/pinhole.rs index 95d09610101d8..6012990a2e492 100644 --- a/crates/store/re_types/src/archetypes/pinhole.rs +++ b/crates/store/re_types/src/archetypes/pinhole.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Camera perspective projection (a.k.a. intrinsics). @@ -136,51 +136,75 @@ pub struct Pinhole { pub image_plane_distance: Option, } -impl ::re_types_core::SizeBytes for Pinhole { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.image_from_camera.heap_size_bytes() - + self.resolution.heap_size_bytes() - + self.camera_xyz.heap_size_bytes() - + self.image_plane_distance.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.PinholeProjection".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "rerun.components.PinholeProjection".into(), + archetype_field_name: Some("image_from_camera".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Resolution".into(), - "rerun.components.PinholeIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "rerun.components.Resolution".into(), + archetype_field_name: Some("resolution".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "PinholeIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ViewCoordinates".into(), - "rerun.components.ImagePlaneDistance".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "rerun.components.ViewCoordinates".into(), + archetype_field_name: Some("camera_xyz".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "rerun.components.ImagePlaneDistance".into(), + archetype_field_name: Some("image_plane_distance".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.PinholeProjection".into(), - "rerun.components.Resolution".into(), - "rerun.components.PinholeIndicator".into(), - "rerun.components.ViewCoordinates".into(), - "rerun.components.ImagePlaneDistance".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "rerun.components.PinholeProjection".into(), + archetype_field_name: Some("image_from_camera".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "rerun.components.Resolution".into(), + archetype_field_name: Some("resolution".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "PinholeIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "rerun.components.ViewCoordinates".into(), + archetype_field_name: Some("camera_xyz".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + component_name: "rerun.components.ImagePlaneDistance".into(), + archetype_field_name: Some("image_plane_distance".into()), + }, ] }); @@ -208,26 +232,26 @@ impl ::re_types_core::Archetype for Pinhole { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: PinholeIndicator = PinholeIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -298,16 +322,52 @@ impl ::re_types_core::AsComponents for Pinhole { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.image_from_camera as &dyn ComponentBatch).into()), - self.resolution + (Some(&self.image_from_camera as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + archetype_field_name: Some(("image_from_camera").into()), + component_name: ("rerun.components.PinholeProjection").into(), + }), + } + }), + (self + .resolution .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.camera_xyz + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + archetype_field_name: Some(("resolution").into()), + component_name: ("rerun.components.Resolution").into(), + }), + }), + (self + .camera_xyz .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.image_plane_distance + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + archetype_field_name: Some(("camera_xyz").into()), + component_name: ("rerun.components.ViewCoordinates").into(), + }), + }), + (self + .image_plane_distance .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Pinhole".into()), + archetype_field_name: Some(("image_plane_distance").into()), + component_name: ("rerun.components.ImagePlaneDistance").into(), + }), + }), ] .into_iter() .flatten() @@ -391,3 +451,21 @@ impl Pinhole { self } } + +impl ::re_types_core::SizeBytes for Pinhole { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.image_from_camera.heap_size_bytes() + + self.resolution.heap_size_bytes() + + self.camera_xyz.heap_size_bytes() + + self.image_plane_distance.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/points2d.rs b/crates/store/re_types/src/archetypes/points2d.rs index 47d327e88752f..550ad06833deb 100644 --- a/crates/store/re_types/src/archetypes/points2d.rs +++ b/crates/store/re_types/src/archetypes/points2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A 2D point cloud with positions and optional colors, radii, labels, etc. @@ -137,67 +137,115 @@ pub struct Points2D { pub keypoint_ids: Option>, } -impl ::re_types_core::SizeBytes for Points2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.positions.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.draw_order.heap_size_bytes() - + self.class_ids.heap_size_bytes() - + self.keypoint_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >::is_pod() - && >>::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Position2D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("positions".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.Points2DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "Points2DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.DrawOrder".into(), - "rerun.components.ClassId".into(), - "rerun.components.KeypointId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.KeypointId".into(), + archetype_field_name: Some("keypoint_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Position2D".into(), - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.Points2DIndicator".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.DrawOrder".into(), - "rerun.components.ClassId".into(), - "rerun.components.KeypointId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("positions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "Points2DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + component_name: "rerun.components.KeypointId".into(), + archetype_field_name: Some("keypoint_ids".into()), + }, ] }); @@ -225,26 +273,26 @@ impl ::re_types_core::Archetype for Points2D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Points2DIndicator = Points2DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -367,28 +415,100 @@ impl ::re_types_core::AsComponents for Points2D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.positions as &dyn ComponentBatch).into()), - self.radii + (Some(&self.positions as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + archetype_field_name: Some(("positions").into()), + component_name: ("rerun.components.Position2D").into(), + }), + } + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.draw_order + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .draw_order .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + archetype_field_name: Some(("draw_order").into()), + component_name: ("rerun.components.DrawOrder").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.keypoint_ids + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), + (self + .keypoint_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points2D".into()), + archetype_field_name: Some(("keypoint_ids").into()), + component_name: ("rerun.components.KeypointId").into(), + }), + }), ] .into_iter() .flatten() @@ -497,3 +617,29 @@ impl Points2D { self } } + +impl ::re_types_core::SizeBytes for Points2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.positions.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.draw_order.heap_size_bytes() + + self.class_ids.heap_size_bytes() + + self.keypoint_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >::is_pod() + && >>::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/points3d.rs b/crates/store/re_types/src/archetypes/points3d.rs index be320be01354c..577d475e87039 100644 --- a/crates/store/re_types/src/archetypes/points3d.rs +++ b/crates/store/re_types/src/archetypes/points3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A 3D point cloud with positions and optional colors, radii, labels, etc. @@ -130,63 +130,105 @@ pub struct Points3D { pub keypoint_ids: Option>, } -impl ::re_types_core::SizeBytes for Points3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.positions.heap_size_bytes() - + self.radii.heap_size_bytes() - + self.colors.heap_size_bytes() - + self.labels.heap_size_bytes() - + self.show_labels.heap_size_bytes() - + self.class_ids.heap_size_bytes() - + self.keypoint_ids.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Position3D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.Position3D".into(), + archetype_field_name: Some("positions".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.Points3DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "Points3DIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), - "rerun.components.KeypointId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.KeypointId".into(), + archetype_field_name: Some("keypoint_ids".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Position3D".into(), - "rerun.components.Radius".into(), - "rerun.components.Color".into(), - "rerun.components.Points3DIndicator".into(), - "rerun.components.Text".into(), - "rerun.components.ShowLabels".into(), - "rerun.components.ClassId".into(), - "rerun.components.KeypointId".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.Position3D".into(), + archetype_field_name: Some("positions".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.Radius".into(), + archetype_field_name: Some("radii".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("colors".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "Points3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.ShowLabels".into(), + archetype_field_name: Some("show_labels".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.ClassId".into(), + archetype_field_name: Some("class_ids".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + component_name: "rerun.components.KeypointId".into(), + archetype_field_name: Some("keypoint_ids".into()), + }, ] }); @@ -214,26 +256,26 @@ impl ::re_types_core::Archetype for Points3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Points3DIndicator = Points3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -346,25 +388,88 @@ impl ::re_types_core::AsComponents for Points3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.positions as &dyn ComponentBatch).into()), - self.radii + (Some(&self.positions as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some(("positions").into()), + component_name: ("rerun.components.Position3D").into(), + }), + } + }), + (self + .radii .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.colors + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some(("radii").into()), + component_name: ("rerun.components.Radius").into(), + }), + }), + (self + .colors .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some(("colors").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .labels .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.show_labels + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some(("labels").into()), + component_name: ("rerun.components.Text").into(), + }), + }), + (self + .show_labels .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.class_ids + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some(("show_labels").into()), + component_name: ("rerun.components.ShowLabels").into(), + }), + }), + (self + .class_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.keypoint_ids + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some(("class_ids").into()), + component_name: ("rerun.components.ClassId").into(), + }), + }), + (self + .keypoint_ids .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some(("keypoint_ids").into()), + component_name: ("rerun.components.KeypointId").into(), + }), + }), ] .into_iter() .flatten() @@ -463,3 +568,27 @@ impl Points3D { self } } + +impl ::re_types_core::SizeBytes for Points3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.positions.heap_size_bytes() + + self.radii.heap_size_bytes() + + self.colors.heap_size_bytes() + + self.labels.heap_size_bytes() + + self.show_labels.heap_size_bytes() + + self.class_ids.heap_size_bytes() + + self.keypoint_ids.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/scalar.rs b/crates/store/re_types/src/archetypes/scalar.rs index f87f9eec60d4c..ccd7b5e849c52 100644 --- a/crates/store/re_types/src/archetypes/scalar.rs +++ b/crates/store/re_types/src/archetypes/scalar.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A double-precision scalar, e.g. for use for time-series plots. @@ -59,32 +59,40 @@ pub struct Scalar { pub scalar: crate::components::Scalar, } -impl ::re_types_core::SizeBytes for Scalar { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.scalar.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Scalar".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Scalar".into()), + component_name: "rerun.components.Scalar".into(), + archetype_field_name: Some("scalar".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.ScalarIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Scalar".into()), + component_name: "ScalarIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Scalar".into(), - "rerun.components.ScalarIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Scalar".into()), + component_name: "rerun.components.Scalar".into(), + archetype_field_name: Some("scalar".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Scalar".into()), + component_name: "ScalarIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -112,26 +120,26 @@ impl ::re_types_core::Archetype for Scalar { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: ScalarIndicator = ScalarIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -168,7 +176,16 @@ impl ::re_types_core::AsComponents for Scalar { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.scalar as &dyn ComponentBatch).into()), + (Some(&self.scalar as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Scalar".into()), + archetype_field_name: Some(("scalar").into()), + component_name: ("rerun.components.Scalar").into(), + }), + } + }), ] .into_iter() .flatten() @@ -187,3 +204,15 @@ impl Scalar { } } } + +impl ::re_types_core::SizeBytes for Scalar { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.scalar.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/segmentation_image.rs b/crates/store/re_types/src/archetypes/segmentation_image.rs index 638916255c945..b06005575ed94 100644 --- a/crates/store/re_types/src/archetypes/segmentation_image.rs +++ b/crates/store/re_types/src/archetypes/segmentation_image.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: An image made up of integer [`components::ClassId`][crate::components::ClassId]s. @@ -83,51 +83,75 @@ pub struct SegmentationImage { pub draw_order: Option, } -impl ::re_types_core::SizeBytes for SegmentationImage { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.buffer.heap_size_bytes() - + self.format.heap_size_bytes() - + self.opacity.heap_size_bytes() - + self.draw_order.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ImageBuffer".into(), - "rerun.components.ImageFormat".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "rerun.components.ImageBuffer".into(), + archetype_field_name: Some("buffer".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "rerun.components.ImageFormat".into(), + archetype_field_name: Some("format".into()), + }, ] }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.SegmentationImageIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "SegmentationImageIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Opacity".into(), - "rerun.components.DrawOrder".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "rerun.components.Opacity".into(), + archetype_field_name: Some("opacity".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ImageBuffer".into(), - "rerun.components.ImageFormat".into(), - "rerun.components.SegmentationImageIndicator".into(), - "rerun.components.Opacity".into(), - "rerun.components.DrawOrder".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "rerun.components.ImageBuffer".into(), + archetype_field_name: Some("buffer".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "rerun.components.ImageFormat".into(), + archetype_field_name: Some("format".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "SegmentationImageIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "rerun.components.Opacity".into(), + archetype_field_name: Some("opacity".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + component_name: "rerun.components.DrawOrder".into(), + archetype_field_name: Some("draw_order".into()), + }, ] }); @@ -155,26 +179,26 @@ impl ::re_types_core::Archetype for SegmentationImage { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: SegmentationImageIndicator = SegmentationImageIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -247,14 +271,50 @@ impl ::re_types_core::AsComponents for SegmentationImage { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.buffer as &dyn ComponentBatch).into()), - Some((&self.format as &dyn ComponentBatch).into()), - self.opacity + (Some(&self.buffer as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + archetype_field_name: Some(("buffer").into()), + component_name: ("rerun.components.ImageBuffer").into(), + }), + } + }), + (Some(&self.format as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + archetype_field_name: Some(("format").into()), + component_name: ("rerun.components.ImageFormat").into(), + }), + } + }), + (self + .opacity .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.draw_order + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + archetype_field_name: Some(("opacity").into()), + component_name: ("rerun.components.Opacity").into(), + }), + }), + (self + .draw_order .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SegmentationImage".into()), + archetype_field_name: Some(("draw_order").into()), + component_name: ("rerun.components.DrawOrder").into(), + }), + }), ] .into_iter() .flatten() @@ -297,3 +357,21 @@ impl SegmentationImage { self } } + +impl ::re_types_core::SizeBytes for SegmentationImage { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.buffer.heap_size_bytes() + + self.format.heap_size_bytes() + + self.opacity.heap_size_bytes() + + self.draw_order.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && ::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/series_line.rs b/crates/store/re_types/src/archetypes/series_line.rs index ccce4ffc5527f..7c1c7d7ad1a23 100644 --- a/crates/store/re_types/src/archetypes/series_line.rs +++ b/crates/store/re_types/src/archetypes/series_line.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Define the style properties for a line series in a chart. @@ -90,48 +90,72 @@ pub struct SeriesLine { pub aggregation_policy: Option, } -impl ::re_types_core::SizeBytes for SeriesLine { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.color.heap_size_bytes() - + self.width.heap_size_bytes() - + self.name.heap_size_bytes() - + self.aggregation_policy.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.SeriesLineIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "SeriesLineIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Color".into(), - "rerun.components.StrokeWidth".into(), - "rerun.components.Name".into(), - "rerun.components.AggregationPolicy".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "rerun.components.StrokeWidth".into(), + archetype_field_name: Some("width".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "rerun.components.Name".into(), + archetype_field_name: Some("name".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "rerun.components.AggregationPolicy".into(), + archetype_field_name: Some("aggregation_policy".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.SeriesLineIndicator".into(), - "rerun.components.Color".into(), - "rerun.components.StrokeWidth".into(), - "rerun.components.Name".into(), - "rerun.components.AggregationPolicy".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "SeriesLineIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "rerun.components.StrokeWidth".into(), + archetype_field_name: Some("width".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "rerun.components.Name".into(), + archetype_field_name: Some("name".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + component_name: "rerun.components.AggregationPolicy".into(), + archetype_field_name: Some("aggregation_policy".into()), + }, ] }); @@ -159,26 +183,26 @@ impl ::re_types_core::Archetype for SeriesLine { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: SeriesLineIndicator = SeriesLineIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -244,18 +268,52 @@ impl ::re_types_core::AsComponents for SeriesLine { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.color + (self + .color .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.width + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + archetype_field_name: Some(("color").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .width .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.name + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + archetype_field_name: Some(("width").into()), + component_name: ("rerun.components.StrokeWidth").into(), + }), + }), + (self.name.as_ref().map(|comp| (comp as &dyn ComponentBatch))).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + archetype_field_name: Some(("name").into()), + component_name: ("rerun.components.Name").into(), + }), + } + }), + (self + .aggregation_policy .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.aggregation_policy - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesLine".into()), + archetype_field_name: Some(("aggregation_policy").into()), + component_name: ("rerun.components.AggregationPolicy").into(), + }), + }), ] .into_iter() .flatten() @@ -314,3 +372,21 @@ impl SeriesLine { self } } + +impl ::re_types_core::SizeBytes for SeriesLine { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.color.heap_size_bytes() + + self.width.heap_size_bytes() + + self.name.heap_size_bytes() + + self.aggregation_policy.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/series_point.rs b/crates/store/re_types/src/archetypes/series_point.rs index 74a2293feab74..e7488f302bc1b 100644 --- a/crates/store/re_types/src/archetypes/series_point.rs +++ b/crates/store/re_types/src/archetypes/series_point.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Define the style properties for a point series in a chart. @@ -88,48 +88,72 @@ pub struct SeriesPoint { pub marker_size: Option, } -impl ::re_types_core::SizeBytes for SeriesPoint { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.color.heap_size_bytes() - + self.marker.heap_size_bytes() - + self.name.heap_size_bytes() - + self.marker_size.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.SeriesPointIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "SeriesPointIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Color".into(), - "rerun.components.MarkerShape".into(), - "rerun.components.Name".into(), - "rerun.components.MarkerSize".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "rerun.components.MarkerShape".into(), + archetype_field_name: Some("marker".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "rerun.components.Name".into(), + archetype_field_name: Some("name".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "rerun.components.MarkerSize".into(), + archetype_field_name: Some("marker_size".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.SeriesPointIndicator".into(), - "rerun.components.Color".into(), - "rerun.components.MarkerShape".into(), - "rerun.components.Name".into(), - "rerun.components.MarkerSize".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "SeriesPointIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "rerun.components.MarkerShape".into(), + archetype_field_name: Some("marker".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "rerun.components.Name".into(), + archetype_field_name: Some("name".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + component_name: "rerun.components.MarkerSize".into(), + archetype_field_name: Some("marker_size".into()), + }, ] }); @@ -157,26 +181,26 @@ impl ::re_types_core::Archetype for SeriesPoint { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: SeriesPointIndicator = SeriesPointIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -241,18 +265,52 @@ impl ::re_types_core::AsComponents for SeriesPoint { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.color + (self + .color .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.marker + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + archetype_field_name: Some(("color").into()), + component_name: ("rerun.components.Color").into(), + }), + }), + (self + .marker .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.name + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + archetype_field_name: Some(("marker").into()), + component_name: ("rerun.components.MarkerShape").into(), + }), + }), + (self.name.as_ref().map(|comp| (comp as &dyn ComponentBatch))).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + archetype_field_name: Some(("name").into()), + component_name: ("rerun.components.Name").into(), + }), + } + }), + (self + .marker_size .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.marker_size - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.SeriesPoint".into()), + archetype_field_name: Some(("marker_size").into()), + component_name: ("rerun.components.MarkerSize").into(), + }), + }), ] .into_iter() .flatten() @@ -307,3 +365,21 @@ impl SeriesPoint { self } } + +impl ::re_types_core::SizeBytes for SeriesPoint { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.color.heap_size_bytes() + + self.marker.heap_size_bytes() + + self.name.heap_size_bytes() + + self.marker_size.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/tensor.rs b/crates/store/re_types/src/archetypes/tensor.rs index f997ab297fb2a..85ab88b35ecec 100644 --- a/crates/store/re_types/src/archetypes/tensor.rs +++ b/crates/store/re_types/src/archetypes/tensor.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: An N-dimensional array of numbers. @@ -67,34 +67,51 @@ pub struct Tensor { pub value_range: Option, } -impl ::re_types_core::SizeBytes for Tensor { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.data.heap_size_bytes() + self.value_range.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.TensorData".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Tensor".into()), + component_name: "rerun.components.TensorData".into(), + archetype_field_name: Some("data".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.TensorIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Tensor".into()), + component_name: "TensorIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.ValueRange".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Tensor".into()), + component_name: "rerun.components.ValueRange".into(), + archetype_field_name: Some("value_range".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.TensorData".into(), - "rerun.components.TensorIndicator".into(), - "rerun.components.ValueRange".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Tensor".into()), + component_name: "rerun.components.TensorData".into(), + archetype_field_name: Some("data".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Tensor".into()), + component_name: "TensorIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Tensor".into()), + component_name: "rerun.components.ValueRange".into(), + archetype_field_name: Some("value_range".into()), + }, ] }); @@ -122,26 +139,26 @@ impl ::re_types_core::Archetype for Tensor { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: TensorIndicator = TensorIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -187,10 +204,28 @@ impl ::re_types_core::AsComponents for Tensor { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.data as &dyn ComponentBatch).into()), - self.value_range + (Some(&self.data as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Tensor".into()), + archetype_field_name: Some(("data").into()), + component_name: ("rerun.components.TensorData").into(), + }), + } + }), + (self + .value_range .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Tensor".into()), + archetype_field_name: Some(("value_range").into()), + component_name: ("rerun.components.ValueRange").into(), + }), + }), ] .into_iter() .flatten() @@ -230,3 +265,16 @@ impl Tensor { self } } + +impl ::re_types_core::SizeBytes for Tensor { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.data.heap_size_bytes() + self.value_range.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/text_document.rs b/crates/store/re_types/src/archetypes/text_document.rs index 7331b76b32aae..a848e424007e3 100644 --- a/crates/store/re_types/src/archetypes/text_document.rs +++ b/crates/store/re_types/src/archetypes/text_document.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A text element intended to be displayed in its own text box. @@ -102,33 +102,51 @@ pub struct TextDocument { pub media_type: Option, } -impl ::re_types_core::SizeBytes for TextDocument { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.text.heap_size_bytes() + self.media_type.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Text".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextDocument".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("text".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.TextDocumentIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextDocument".into()), + component_name: "TextDocumentIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.MediaType".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextDocument".into()), + component_name: "rerun.components.MediaType".into(), + archetype_field_name: Some("media_type".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Text".into(), - "rerun.components.TextDocumentIndicator".into(), - "rerun.components.MediaType".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextDocument".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("text".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextDocument".into()), + component_name: "TextDocumentIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextDocument".into()), + component_name: "rerun.components.MediaType".into(), + archetype_field_name: Some("media_type".into()), + }, ] }); @@ -156,26 +174,26 @@ impl ::re_types_core::Archetype for TextDocument { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: TextDocumentIndicator = TextDocumentIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -221,10 +239,28 @@ impl ::re_types_core::AsComponents for TextDocument { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.text as &dyn ComponentBatch).into()), - self.media_type + (Some(&self.text as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextDocument".into()), + archetype_field_name: Some(("text").into()), + component_name: ("rerun.components.Text").into(), + }), + } + }), + (self + .media_type .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextDocument".into()), + archetype_field_name: Some(("media_type").into()), + component_name: ("rerun.components.MediaType").into(), + }), + }), ] .into_iter() .flatten() @@ -257,3 +293,15 @@ impl TextDocument { self } } + +impl ::re_types_core::SizeBytes for TextDocument { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.text.heap_size_bytes() + self.media_type.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/text_log.rs b/crates/store/re_types/src/archetypes/text_log.rs index 20aaaca3b5245..18c29cff110c7 100644 --- a/crates/store/re_types/src/archetypes/text_log.rs +++ b/crates/store/re_types/src/archetypes/text_log.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A log entry in a text log, comprised of a text body and its log level. @@ -72,41 +72,63 @@ pub struct TextLog { pub color: Option, } -impl ::re_types_core::SizeBytes for TextLog { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.text.heap_size_bytes() + self.level.heap_size_bytes() + self.color.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Text".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("text".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.TextLogLevel".into(), - "rerun.components.TextLogIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + component_name: "rerun.components.TextLogLevel".into(), + archetype_field_name: Some("level".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + component_name: "TextLogIndicator".into(), + archetype_field_name: None, + }, ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Color".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Text".into(), - "rerun.components.TextLogLevel".into(), - "rerun.components.TextLogIndicator".into(), - "rerun.components.Color".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + component_name: "rerun.components.Text".into(), + archetype_field_name: Some("text".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + component_name: "rerun.components.TextLogLevel".into(), + archetype_field_name: Some("level".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + component_name: "TextLogIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }, ] }); @@ -134,26 +156,26 @@ impl ::re_types_core::Archetype for TextLog { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: TextLogIndicator = TextLogIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -208,13 +230,40 @@ impl ::re_types_core::AsComponents for TextLog { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.text as &dyn ComponentBatch).into()), - self.level + (Some(&self.text as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + archetype_field_name: Some(("text").into()), + component_name: ("rerun.components.Text").into(), + }), + } + }), + (self + .level .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.color + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + archetype_field_name: Some(("level").into()), + component_name: ("rerun.components.TextLogLevel").into(), + }), + }), + (self + .color .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.TextLog".into()), + archetype_field_name: Some(("color").into()), + component_name: ("rerun.components.Color").into(), + }), + }), ] .into_iter() .flatten() @@ -251,3 +300,17 @@ impl TextLog { self } } + +impl ::re_types_core::SizeBytes for TextLog { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.text.heap_size_bytes() + self.level.heap_size_bytes() + self.color.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/transform3d.rs b/crates/store/re_types/src/archetypes/transform3d.rs index 0fcec845a1096..b7086fd99d522 100644 --- a/crates/store/re_types/src/archetypes/transform3d.rs +++ b/crates/store/re_types/src/archetypes/transform3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: A transform between two 3D spaces, i.e. a pose. @@ -193,60 +193,102 @@ pub struct Transform3D { pub axis_length: Option, } -impl ::re_types_core::SizeBytes for Transform3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.translation.heap_size_bytes() - + self.rotation_axis_angle.heap_size_bytes() - + self.quaternion.heap_size_bytes() - + self.scale.heap_size_bytes() - + self.mat3x3.heap_size_bytes() - + self.relation.heap_size_bytes() - + self.axis_length.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Transform3DIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "Transform3DIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Translation3D".into(), - "rerun.components.RotationAxisAngle".into(), - "rerun.components.RotationQuat".into(), - "rerun.components.Scale3D".into(), - "rerun.components.TransformMat3x3".into(), - "rerun.components.TransformRelation".into(), - "rerun.components.AxisLength".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.Translation3D".into(), + archetype_field_name: Some("translation".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.RotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angle".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.RotationQuat".into(), + archetype_field_name: Some("quaternion".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.Scale3D".into(), + archetype_field_name: Some("scale".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.TransformMat3x3".into(), + archetype_field_name: Some("mat3x3".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.TransformRelation".into(), + archetype_field_name: Some("relation".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.AxisLength".into(), + archetype_field_name: Some("axis_length".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Transform3DIndicator".into(), - "rerun.components.Translation3D".into(), - "rerun.components.RotationAxisAngle".into(), - "rerun.components.RotationQuat".into(), - "rerun.components.Scale3D".into(), - "rerun.components.TransformMat3x3".into(), - "rerun.components.TransformRelation".into(), - "rerun.components.AxisLength".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "Transform3DIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.Translation3D".into(), + archetype_field_name: Some("translation".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.RotationAxisAngle".into(), + archetype_field_name: Some("rotation_axis_angle".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.RotationQuat".into(), + archetype_field_name: Some("quaternion".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.Scale3D".into(), + archetype_field_name: Some("scale".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.TransformMat3x3".into(), + archetype_field_name: Some("mat3x3".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.TransformRelation".into(), + archetype_field_name: Some("relation".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.AxisLength".into(), + archetype_field_name: Some("axis_length".into()), + }, ] }); @@ -274,26 +316,26 @@ impl ::re_types_core::Archetype for Transform3D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: Transform3DIndicator = Transform3DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -391,13 +433,76 @@ impl ::re_types_core::AsComponents for Transform3D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.translation as &dyn ComponentBatch).into()), - Some((&self.rotation_axis_angle as &dyn ComponentBatch).into()), - Some((&self.quaternion as &dyn ComponentBatch).into()), - Some((&self.scale as &dyn ComponentBatch).into()), - Some((&self.mat3x3 as &dyn ComponentBatch).into()), - Some((&self.relation as &dyn ComponentBatch).into()), - Some((&self.axis_length as &dyn ComponentBatch).into()), + (Some(&self.translation as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + archetype_field_name: Some(("translation").into()), + component_name: ("rerun.components.Translation3D").into(), + }), + } + }), + (Some(&self.rotation_axis_angle as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + archetype_field_name: Some(("rotation_axis_angle").into()), + component_name: ("rerun.components.RotationAxisAngle").into(), + }), + } + }), + (Some(&self.quaternion as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + archetype_field_name: Some(("quaternion").into()), + component_name: ("rerun.components.RotationQuat").into(), + }), + } + }), + (Some(&self.scale as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + archetype_field_name: Some(("scale").into()), + component_name: ("rerun.components.Scale3D").into(), + }), + } + }), + (Some(&self.mat3x3 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + archetype_field_name: Some(("mat3x3").into()), + component_name: ("rerun.components.TransformMat3x3").into(), + }), + } + }), + (Some(&self.relation as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + archetype_field_name: Some(("relation").into()), + component_name: ("rerun.components.TransformRelation").into(), + }), + } + }), + (Some(&self.axis_length as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + archetype_field_name: Some(("axis_length").into()), + component_name: ("rerun.components.AxisLength").into(), + }), + } + }), ] .into_iter() .flatten() @@ -489,3 +594,27 @@ impl Transform3D { self } } + +impl ::re_types_core::SizeBytes for Transform3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.translation.heap_size_bytes() + + self.rotation_axis_angle.heap_size_bytes() + + self.quaternion.heap_size_bytes() + + self.scale.heap_size_bytes() + + self.mat3x3.heap_size_bytes() + + self.relation.heap_size_bytes() + + self.axis_length.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/video_frame_reference.rs b/crates/store/re_types/src/archetypes/video_frame_reference.rs index 8fb800d7e6e01..594d82550eb29 100644 --- a/crates/store/re_types/src/archetypes/video_frame_reference.rs +++ b/crates/store/re_types/src/archetypes/video_frame_reference.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: References a single video frame. @@ -146,34 +146,51 @@ pub struct VideoFrameReference { pub video_reference: Option, } -impl ::re_types_core::SizeBytes for VideoFrameReference { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.timestamp.heap_size_bytes() + self.video_reference.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.VideoTimestamp".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), + component_name: "rerun.components.VideoTimestamp".into(), + archetype_field_name: Some("timestamp".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.VideoFrameReferenceIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), + component_name: "VideoFrameReferenceIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.EntityPath".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), + component_name: "rerun.components.EntityPath".into(), + archetype_field_name: Some("video_reference".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.VideoTimestamp".into(), - "rerun.components.VideoFrameReferenceIndicator".into(), - "rerun.components.EntityPath".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), + component_name: "rerun.components.VideoTimestamp".into(), + archetype_field_name: Some("timestamp".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), + component_name: "VideoFrameReferenceIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), + component_name: "rerun.components.EntityPath".into(), + archetype_field_name: Some("video_reference".into()), + }, ] }); @@ -202,26 +219,26 @@ impl ::re_types_core::Archetype for VideoFrameReference { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: VideoFrameReferenceIndicator = VideoFrameReferenceIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -271,10 +288,28 @@ impl ::re_types_core::AsComponents for VideoFrameReference { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.timestamp as &dyn ComponentBatch).into()), - self.video_reference + (Some(&self.timestamp as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), + archetype_field_name: Some(("timestamp").into()), + component_name: ("rerun.components.VideoTimestamp").into(), + }), + } + }), + (self + .video_reference .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), + archetype_field_name: Some(("video_reference").into()), + component_name: ("rerun.components.EntityPath").into(), + }), + }), ] .into_iter() .flatten() @@ -312,3 +347,16 @@ impl VideoFrameReference { self } } + +impl ::re_types_core::SizeBytes for VideoFrameReference { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.timestamp.heap_size_bytes() + self.video_reference.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/archetypes/view_coordinates.rs b/crates/store/re_types/src/archetypes/view_coordinates.rs index 51162a56efcba..36a6e86f82ee8 100644 --- a/crates/store/re_types/src/archetypes/view_coordinates.rs +++ b/crates/store/re_types/src/archetypes/view_coordinates.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: How we interpret the coordinate system of an entity/space. @@ -66,32 +66,40 @@ pub struct ViewCoordinates { pub xyz: crate::components::ViewCoordinates, } -impl ::re_types_core::SizeBytes for ViewCoordinates { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.xyz.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.ViewCoordinates".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.ViewCoordinates".into()), + component_name: "rerun.components.ViewCoordinates".into(), + archetype_field_name: Some("xyz".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.ViewCoordinatesIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.ViewCoordinates".into()), + component_name: "ViewCoordinatesIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ViewCoordinates".into(), - "rerun.components.ViewCoordinatesIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.ViewCoordinates".into()), + component_name: "rerun.components.ViewCoordinates".into(), + archetype_field_name: Some("xyz".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.ViewCoordinates".into()), + component_name: "ViewCoordinatesIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -119,26 +127,26 @@ impl ::re_types_core::Archetype for ViewCoordinates { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: ViewCoordinatesIndicator = ViewCoordinatesIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -175,7 +183,16 @@ impl ::re_types_core::AsComponents for ViewCoordinates { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.xyz as &dyn ComponentBatch).into()), + (Some(&self.xyz as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.ViewCoordinates".into()), + archetype_field_name: Some(("xyz").into()), + component_name: ("rerun.components.ViewCoordinates").into(), + }), + } + }), ] .into_iter() .flatten() @@ -192,3 +209,15 @@ impl ViewCoordinates { Self { xyz: xyz.into() } } } + +impl ::re_types_core::SizeBytes for ViewCoordinates { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.xyz.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/background.rs b/crates/store/re_types/src/blueprint/archetypes/background.rs index 382aae7d7a8d2..ff7c65820a001 100644 --- a/crates/store/re_types/src/blueprint/archetypes/background.rs +++ b/crates/store/re_types/src/blueprint/archetypes/background.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Configuration for the background of a view. @@ -28,34 +28,51 @@ pub struct Background { pub color: Option, } -impl ::re_types_core::SizeBytes for Background { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.kind.heap_size_bytes() + self.color.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.BackgroundKind".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.Background".into()), + component_name: "rerun.blueprint.components.BackgroundKind".into(), + archetype_field_name: Some("kind".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.BackgroundIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.Background".into()), + component_name: "BackgroundIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.Color".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.Background".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.BackgroundKind".into(), - "rerun.blueprint.components.BackgroundIndicator".into(), - "rerun.components.Color".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.Background".into()), + component_name: "rerun.blueprint.components.BackgroundKind".into(), + archetype_field_name: Some("kind".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.Background".into()), + component_name: "BackgroundIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.Background".into()), + component_name: "rerun.components.Color".into(), + archetype_field_name: Some("color".into()), + }, ] }); @@ -83,26 +100,26 @@ impl ::re_types_core::Archetype for Background { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: BackgroundIndicator = BackgroundIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -148,10 +165,28 @@ impl ::re_types_core::AsComponents for Background { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.kind as &dyn ComponentBatch).into()), - self.color + (Some(&self.kind as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.Background".into()), + archetype_field_name: Some(("kind").into()), + component_name: ("rerun.blueprint.components.BackgroundKind").into(), + }), + } + }), + (self + .color .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.Background".into()), + archetype_field_name: Some(("color").into()), + component_name: ("rerun.components.Color").into(), + }), + }), ] .into_iter() .flatten() @@ -178,3 +213,16 @@ impl Background { self } } + +impl ::re_types_core::SizeBytes for Background { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.kind.heap_size_bytes() + self.color.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs b/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs index 78c9dd1ffc0e9..c107d93daedee 100644 --- a/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs +++ b/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The query for the dataframe view. @@ -41,52 +41,82 @@ pub struct DataframeQuery { pub select: Option, } -impl ::re_types_core::SizeBytes for DataframeQuery { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.timeline.heap_size_bytes() - + self.filter_by_range.heap_size_bytes() - + self.filter_is_not_null.heap_size_bytes() - + self.apply_latest_at.heap_size_bytes() - + self.select.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.DataframeQueryIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "DataframeQueryIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.TimelineName".into(), - "rerun.blueprint.components.FilterByRange".into(), - "rerun.blueprint.components.FilterIsNotNull".into(), - "rerun.blueprint.components.ApplyLatestAt".into(), - "rerun.blueprint.components.SelectedColumns".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.TimelineName".into(), + archetype_field_name: Some("timeline".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.FilterByRange".into(), + archetype_field_name: Some("filter_by_range".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.FilterIsNotNull".into(), + archetype_field_name: Some("filter_is_not_null".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.ApplyLatestAt".into(), + archetype_field_name: Some("apply_latest_at".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.SelectedColumns".into(), + archetype_field_name: Some("select".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.DataframeQueryIndicator".into(), - "rerun.blueprint.components.TimelineName".into(), - "rerun.blueprint.components.FilterByRange".into(), - "rerun.blueprint.components.FilterIsNotNull".into(), - "rerun.blueprint.components.ApplyLatestAt".into(), - "rerun.blueprint.components.SelectedColumns".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "DataframeQueryIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.TimelineName".into(), + archetype_field_name: Some("timeline".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.FilterByRange".into(), + archetype_field_name: Some("filter_by_range".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.FilterIsNotNull".into(), + archetype_field_name: Some("filter_is_not_null".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.ApplyLatestAt".into(), + archetype_field_name: Some("apply_latest_at".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + component_name: "rerun.blueprint.components.SelectedColumns".into(), + archetype_field_name: Some("select".into()), + }, ] }); @@ -114,26 +144,26 @@ impl ::re_types_core::Archetype for DataframeQuery { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: DataframeQueryIndicator = DataframeQueryIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -213,21 +243,66 @@ impl ::re_types_core::AsComponents for DataframeQuery { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.timeline + (self + .timeline .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.filter_by_range + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + archetype_field_name: Some(("timeline").into()), + component_name: ("rerun.blueprint.components.TimelineName").into(), + }), + }), + (self + .filter_by_range .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.filter_is_not_null + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + archetype_field_name: Some(("filter_by_range").into()), + component_name: ("rerun.blueprint.components.FilterByRange").into(), + }), + }), + (self + .filter_is_not_null .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.apply_latest_at + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + archetype_field_name: Some(("filter_is_not_null").into()), + component_name: ("rerun.blueprint.components.FilterIsNotNull").into(), + }), + }), + (self + .apply_latest_at .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.select + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + archetype_field_name: Some(("apply_latest_at").into()), + component_name: ("rerun.blueprint.components.ApplyLatestAt").into(), + }), + }), + (self + .select .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), + archetype_field_name: Some(("select").into()), + component_name: ("rerun.blueprint.components.SelectedColumns").into(), + }), + }), ] .into_iter() .flatten() @@ -304,3 +379,23 @@ impl DataframeQuery { self } } + +impl ::re_types_core::SizeBytes for DataframeQuery { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.timeline.heap_size_bytes() + + self.filter_by_range.heap_size_bytes() + + self.filter_is_not_null.heap_size_bytes() + + self.apply_latest_at.heap_size_bytes() + + self.select.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/map_background.rs b/crates/store/re_types/src/blueprint/archetypes/map_background.rs index b6acd8df48a8c..37def660af1f3 100644 --- a/crates/store/re_types/src/blueprint/archetypes/map_background.rs +++ b/crates/store/re_types/src/blueprint/archetypes/map_background.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Configuration for the background map of the map view. @@ -27,32 +27,40 @@ pub struct MapBackground { pub provider: crate::blueprint::components::MapProvider, } -impl ::re_types_core::SizeBytes for MapBackground { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.provider.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.MapBackgroundIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapBackground".into()), + component_name: "MapBackgroundIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.MapProvider".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapBackground".into()), + component_name: "rerun.blueprint.components.MapProvider".into(), + archetype_field_name: Some("provider".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.MapBackgroundIndicator".into(), - "rerun.blueprint.components.MapProvider".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapBackground".into()), + component_name: "MapBackgroundIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapBackground".into()), + component_name: "rerun.blueprint.components.MapProvider".into(), + archetype_field_name: Some("provider".into()), + }, ] }); @@ -80,26 +88,26 @@ impl ::re_types_core::Archetype for MapBackground { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: MapBackgroundIndicator = MapBackgroundIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -136,7 +144,16 @@ impl ::re_types_core::AsComponents for MapBackground { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.provider as &dyn ComponentBatch).into()), + (Some(&self.provider as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapBackground".into()), + archetype_field_name: Some(("provider").into()), + component_name: ("rerun.blueprint.components.MapProvider").into(), + }), + } + }), ] .into_iter() .flatten() @@ -155,3 +172,15 @@ impl MapBackground { } } } + +impl ::re_types_core::SizeBytes for MapBackground { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.provider.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/map_zoom.rs b/crates/store/re_types/src/blueprint/archetypes/map_zoom.rs index 6c7057b7bdabc..a20cac4358a3c 100644 --- a/crates/store/re_types/src/blueprint/archetypes/map_zoom.rs +++ b/crates/store/re_types/src/blueprint/archetypes/map_zoom.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Configuration of the map view zoom level. @@ -27,32 +27,40 @@ pub struct MapZoom { pub zoom: crate::blueprint::components::ZoomLevel, } -impl ::re_types_core::SizeBytes for MapZoom { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.zoom.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.MapZoomIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapZoom".into()), + component_name: "MapZoomIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.ZoomLevel".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapZoom".into()), + component_name: "rerun.blueprint.components.ZoomLevel".into(), + archetype_field_name: Some("zoom".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.MapZoomIndicator".into(), - "rerun.blueprint.components.ZoomLevel".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapZoom".into()), + component_name: "MapZoomIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapZoom".into()), + component_name: "rerun.blueprint.components.ZoomLevel".into(), + archetype_field_name: Some("zoom".into()), + }, ] }); @@ -80,26 +88,26 @@ impl ::re_types_core::Archetype for MapZoom { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: MapZoomIndicator = MapZoomIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -136,7 +144,16 @@ impl ::re_types_core::AsComponents for MapZoom { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.zoom as &dyn ComponentBatch).into()), + (Some(&self.zoom as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.MapZoom".into()), + archetype_field_name: Some(("zoom").into()), + component_name: ("rerun.blueprint.components.ZoomLevel").into(), + }), + } + }), ] .into_iter() .flatten() @@ -153,3 +170,15 @@ impl MapZoom { Self { zoom: zoom.into() } } } + +impl ::re_types_core::SizeBytes for MapZoom { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.zoom.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/plot_legend.rs b/crates/store/re_types/src/blueprint/archetypes/plot_legend.rs index 14ac217a5b9a9..17e3e78db66c2 100644 --- a/crates/store/re_types/src/blueprint/archetypes/plot_legend.rs +++ b/crates/store/re_types/src/blueprint/archetypes/plot_legend.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Configuration for the legend of a plot. @@ -32,39 +32,52 @@ pub struct PlotLegend { pub visible: Option, } -impl ::re_types_core::SizeBytes for PlotLegend { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.corner.heap_size_bytes() + self.visible.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.PlotLegendIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), + component_name: "PlotLegendIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.Corner2D".into(), - "rerun.blueprint.components.Visible".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), + component_name: "rerun.blueprint.components.Corner2D".into(), + archetype_field_name: Some("corner".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), + component_name: "rerun.blueprint.components.Visible".into(), + archetype_field_name: Some("visible".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.PlotLegendIndicator".into(), - "rerun.blueprint.components.Corner2D".into(), - "rerun.blueprint.components.Visible".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), + component_name: "PlotLegendIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), + component_name: "rerun.blueprint.components.Corner2D".into(), + archetype_field_name: Some("corner".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), + component_name: "rerun.blueprint.components.Visible".into(), + archetype_field_name: Some("visible".into()), + }, ] }); @@ -92,26 +105,26 @@ impl ::re_types_core::Archetype for PlotLegend { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: PlotLegendIndicator = PlotLegendIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -155,12 +168,30 @@ impl ::re_types_core::AsComponents for PlotLegend { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.corner + (self + .corner .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.visible + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), + archetype_field_name: Some(("corner").into()), + component_name: ("rerun.blueprint.components.Corner2D").into(), + }), + }), + (self + .visible .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), + archetype_field_name: Some(("visible").into()), + component_name: ("rerun.blueprint.components.Visible").into(), + }), + }), ] .into_iter() .flatten() @@ -204,3 +235,16 @@ impl PlotLegend { self } } + +impl ::re_types_core::SizeBytes for PlotLegend { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.corner.heap_size_bytes() + self.visible.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs b/crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs index c7ce46374843c..44b258dc35cd0 100644 --- a/crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs +++ b/crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Configuration for the scalar axis of a plot. @@ -30,39 +30,52 @@ pub struct ScalarAxis { pub zoom_lock: Option, } -impl ::re_types_core::SizeBytes for ScalarAxis { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.range.heap_size_bytes() + self.zoom_lock.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.ScalarAxisIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), + component_name: "ScalarAxisIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Range1D".into(), - "rerun.blueprint.components.LockRangeDuringZoom".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), + component_name: "rerun.components.Range1D".into(), + archetype_field_name: Some("range".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), + component_name: "rerun.blueprint.components.LockRangeDuringZoom".into(), + archetype_field_name: Some("zoom_lock".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.ScalarAxisIndicator".into(), - "rerun.components.Range1D".into(), - "rerun.blueprint.components.LockRangeDuringZoom".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), + component_name: "ScalarAxisIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), + component_name: "rerun.components.Range1D".into(), + archetype_field_name: Some("range".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), + component_name: "rerun.blueprint.components.LockRangeDuringZoom".into(), + archetype_field_name: Some("zoom_lock".into()), + }, ] }); @@ -90,26 +103,26 @@ impl ::re_types_core::Archetype for ScalarAxis { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: ScalarAxisIndicator = ScalarAxisIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -153,12 +166,30 @@ impl ::re_types_core::AsComponents for ScalarAxis { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.range + (self + .range .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.zoom_lock + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), + archetype_field_name: Some(("range").into()), + component_name: ("rerun.components.Range1D").into(), + }), + }), + (self + .zoom_lock .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), + archetype_field_name: Some(("zoom_lock").into()), + component_name: ("rerun.blueprint.components.LockRangeDuringZoom").into(), + }), + }), ] .into_iter() .flatten() @@ -197,3 +228,16 @@ impl ScalarAxis { self } } + +impl ::re_types_core::SizeBytes for ScalarAxis { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.range.heap_size_bytes() + self.zoom_lock.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs b/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs index 119519f21ecd3..45a791dfbe8ee 100644 --- a/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs +++ b/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The description of a single view. @@ -42,49 +42,73 @@ pub struct SpaceViewBlueprint { pub visible: Option, } -impl ::re_types_core::SizeBytes for SpaceViewBlueprint { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.class_identifier.heap_size_bytes() - + self.display_name.heap_size_bytes() - + self.space_origin.heap_size_bytes() - + self.visible.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.SpaceViewClass".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "rerun.blueprint.components.SpaceViewClass".into(), + archetype_field_name: Some("class_identifier".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new( - || ["rerun.blueprint.components.SpaceViewBlueprintIndicator".into()], - ); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "SpaceViewBlueprintIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Name".into(), - "rerun.blueprint.components.SpaceViewOrigin".into(), - "rerun.blueprint.components.Visible".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "rerun.components.Name".into(), + archetype_field_name: Some("display_name".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "rerun.blueprint.components.SpaceViewOrigin".into(), + archetype_field_name: Some("space_origin".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "rerun.blueprint.components.Visible".into(), + archetype_field_name: Some("visible".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.SpaceViewClass".into(), - "rerun.blueprint.components.SpaceViewBlueprintIndicator".into(), - "rerun.components.Name".into(), - "rerun.blueprint.components.SpaceViewOrigin".into(), - "rerun.blueprint.components.Visible".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "rerun.blueprint.components.SpaceViewClass".into(), + archetype_field_name: Some("class_identifier".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "SpaceViewBlueprintIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "rerun.components.Name".into(), + archetype_field_name: Some("display_name".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "rerun.blueprint.components.SpaceViewOrigin".into(), + archetype_field_name: Some("space_origin".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + component_name: "rerun.blueprint.components.Visible".into(), + archetype_field_name: Some("visible".into()), + }, ] }); @@ -113,26 +137,26 @@ impl ::re_types_core::Archetype for SpaceViewBlueprint { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: SpaceViewBlueprintIndicator = SpaceViewBlueprintIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -203,16 +227,54 @@ impl ::re_types_core::AsComponents for SpaceViewBlueprint { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.class_identifier as &dyn ComponentBatch).into()), - self.display_name + (Some(&self.class_identifier as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some( + "rerun.blueprint.archetypes.SpaceViewBlueprint".into(), + ), + archetype_field_name: Some(("class_identifier").into()), + component_name: ("rerun.blueprint.components.SpaceViewClass").into(), + }), + } + }), + (self + .display_name .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.space_origin + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_field_name: Some(("display_name").into()), + component_name: ("rerun.components.Name").into(), + }), + }), + (self + .space_origin .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.visible + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_field_name: Some(("space_origin").into()), + component_name: ("rerun.blueprint.components.SpaceViewOrigin").into(), + }), + }), + (self + .visible .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_field_name: Some(("visible").into()), + component_name: ("rerun.blueprint.components.Visible").into(), + }), + }), ] .into_iter() .flatten() @@ -269,3 +331,21 @@ impl SpaceViewBlueprint { self } } + +impl ::re_types_core::SizeBytes for SpaceViewBlueprint { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.class_identifier.heap_size_bytes() + + self.display_name.heap_size_bytes() + + self.space_origin.heap_size_bytes() + + self.visible.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs b/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs index 05efbc1e0a8c1..142b53b7161b4 100644 --- a/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs +++ b/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The contents of a `SpaceView`. @@ -64,32 +64,40 @@ pub struct SpaceViewContents { pub query: Vec, } -impl ::re_types_core::SizeBytes for SpaceViewContents { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.query.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.SpaceViewContentsIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), + component_name: "SpaceViewContentsIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.QueryExpression".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), + component_name: "rerun.blueprint.components.QueryExpression".into(), + archetype_field_name: Some("query".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.SpaceViewContentsIndicator".into(), - "rerun.blueprint.components.QueryExpression".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), + component_name: "SpaceViewContentsIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), + component_name: "rerun.blueprint.components.QueryExpression".into(), + archetype_field_name: Some("query".into()), + }, ] }); @@ -117,26 +125,26 @@ impl ::re_types_core::Archetype for SpaceViewContents { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: SpaceViewContentsIndicator = SpaceViewContentsIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -172,7 +180,16 @@ impl ::re_types_core::AsComponents for SpaceViewContents { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.query as &dyn ComponentBatch).into()), + (Some(&self.query as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), + archetype_field_name: Some(("query").into()), + component_name: ("rerun.blueprint.components.QueryExpression").into(), + }), + } + }), ] .into_iter() .flatten() @@ -193,3 +210,15 @@ impl SpaceViewContents { } } } + +impl ::re_types_core::SizeBytes for SpaceViewContents { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.query.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/tensor_scalar_mapping.rs b/crates/store/re_types/src/blueprint/archetypes/tensor_scalar_mapping.rs index b07e5ea686e21..077c393e72616 100644 --- a/crates/store/re_types/src/blueprint/archetypes/tensor_scalar_mapping.rs +++ b/crates/store/re_types/src/blueprint/archetypes/tensor_scalar_mapping.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Configures how tensor scalars are mapped to color. @@ -39,46 +39,62 @@ pub struct TensorScalarMapping { pub gamma: Option, } -impl ::re_types_core::SizeBytes for TensorScalarMapping { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.mag_filter.heap_size_bytes() - + self.colormap.heap_size_bytes() - + self.gamma.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = once_cell::sync::Lazy::new(|| { - ["rerun.blueprint.components.TensorScalarMappingIndicator".into()] + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + component_name: "TensorScalarMappingIndicator".into(), + archetype_field_name: None, + }] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.MagnificationFilter".into(), - "rerun.components.Colormap".into(), - "rerun.components.GammaCorrection".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + component_name: "rerun.components.MagnificationFilter".into(), + archetype_field_name: Some("mag_filter".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + component_name: "rerun.components.Colormap".into(), + archetype_field_name: Some("colormap".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + component_name: "rerun.components.GammaCorrection".into(), + archetype_field_name: Some("gamma".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.TensorScalarMappingIndicator".into(), - "rerun.components.MagnificationFilter".into(), - "rerun.components.Colormap".into(), - "rerun.components.GammaCorrection".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + component_name: "TensorScalarMappingIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + component_name: "rerun.components.MagnificationFilter".into(), + archetype_field_name: Some("mag_filter".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + component_name: "rerun.components.Colormap".into(), + archetype_field_name: Some("colormap".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + component_name: "rerun.components.GammaCorrection".into(), + archetype_field_name: Some("gamma".into()), + }, ] }); @@ -107,26 +123,26 @@ impl ::re_types_core::Archetype for TensorScalarMapping { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: TensorScalarMappingIndicator = TensorScalarMappingIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -182,15 +198,42 @@ impl ::re_types_core::AsComponents for TensorScalarMapping { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.mag_filter + (self + .mag_filter .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.colormap + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + archetype_field_name: Some(("mag_filter").into()), + component_name: ("rerun.components.MagnificationFilter").into(), + }), + }), + (self + .colormap .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.gamma + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + archetype_field_name: Some(("colormap").into()), + component_name: ("rerun.components.Colormap").into(), + }), + }), + (self + .gamma .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), + archetype_field_name: Some(("gamma").into()), + component_name: ("rerun.components.GammaCorrection").into(), + }), + }), ] .into_iter() .flatten() @@ -243,3 +286,19 @@ impl TensorScalarMapping { self } } + +impl ::re_types_core::SizeBytes for TensorScalarMapping { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.mag_filter.heap_size_bytes() + + self.colormap.heap_size_bytes() + + self.gamma.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/tensor_slice_selection.rs b/crates/store/re_types/src/blueprint/archetypes/tensor_slice_selection.rs index 02f719d986ed4..cfbe92af57990 100644 --- a/crates/store/re_types/src/blueprint/archetypes/tensor_slice_selection.rs +++ b/crates/store/re_types/src/blueprint/archetypes/tensor_slice_selection.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Specifies a 2D slice of a tensor. @@ -44,50 +44,72 @@ pub struct TensorSliceSelection { pub slider: Option>, } -impl ::re_types_core::SizeBytes for TensorSliceSelection { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.width.heap_size_bytes() - + self.height.heap_size_bytes() - + self.indices.heap_size_bytes() - + self.slider.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >>::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = once_cell::sync::Lazy::new(|| { - ["rerun.blueprint.components.TensorSliceSelectionIndicator".into()] + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "TensorSliceSelectionIndicator".into(), + archetype_field_name: None, + }] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.TensorWidthDimension".into(), - "rerun.components.TensorHeightDimension".into(), - "rerun.components.TensorDimensionIndexSelection".into(), - "rerun.blueprint.components.TensorDimensionIndexSlider".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "rerun.components.TensorWidthDimension".into(), + archetype_field_name: Some("width".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "rerun.components.TensorHeightDimension".into(), + archetype_field_name: Some("height".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "rerun.components.TensorDimensionIndexSelection".into(), + archetype_field_name: Some("indices".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "rerun.blueprint.components.TensorDimensionIndexSlider".into(), + archetype_field_name: Some("slider".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.TensorSliceSelectionIndicator".into(), - "rerun.components.TensorWidthDimension".into(), - "rerun.components.TensorHeightDimension".into(), - "rerun.components.TensorDimensionIndexSelection".into(), - "rerun.blueprint.components.TensorDimensionIndexSlider".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "TensorSliceSelectionIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "rerun.components.TensorWidthDimension".into(), + archetype_field_name: Some("width".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "rerun.components.TensorHeightDimension".into(), + archetype_field_name: Some("height".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "rerun.components.TensorDimensionIndexSelection".into(), + archetype_field_name: Some("indices".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + component_name: "rerun.blueprint.components.TensorDimensionIndexSlider".into(), + archetype_field_name: Some("slider".into()), + }, ] }); @@ -116,26 +138,26 @@ impl ::re_types_core::Archetype for TensorSliceSelection { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: TensorSliceSelectionIndicator = TensorSliceSelectionIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -214,18 +236,55 @@ impl ::re_types_core::AsComponents for TensorSliceSelection { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.width + (self + .width .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.height + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + archetype_field_name: Some(("width").into()), + component_name: ("rerun.components.TensorWidthDimension").into(), + }), + }), + (self + .height .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.indices + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + archetype_field_name: Some(("height").into()), + component_name: ("rerun.components.TensorHeightDimension").into(), + }), + }), + (self + .indices .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.slider + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + archetype_field_name: Some(("indices").into()), + component_name: ("rerun.components.TensorDimensionIndexSelection").into(), + }), + }), + (self + .slider .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), + archetype_field_name: Some(("slider").into()), + component_name: ("rerun.blueprint.components.TensorDimensionIndexSlider") + .into(), + }), + }), ] .into_iter() .flatten() @@ -296,3 +355,21 @@ impl TensorSliceSelection { self } } + +impl ::re_types_core::SizeBytes for TensorSliceSelection { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.width.heap_size_bytes() + + self.height.heap_size_bytes() + + self.indices.heap_size_bytes() + + self.slider.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >>::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/tensor_view_fit.rs b/crates/store/re_types/src/blueprint/archetypes/tensor_view_fit.rs index 307f4db131e91..914734974a056 100644 --- a/crates/store/re_types/src/blueprint/archetypes/tensor_view_fit.rs +++ b/crates/store/re_types/src/blueprint/archetypes/tensor_view_fit.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Configures how a selected tensor slice is shown on screen. @@ -25,32 +25,40 @@ pub struct TensorViewFit { pub scaling: Option, } -impl ::re_types_core::SizeBytes for TensorViewFit { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.scaling.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.TensorViewFitIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorViewFit".into()), + component_name: "TensorViewFitIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.ViewFit".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorViewFit".into()), + component_name: "rerun.blueprint.components.ViewFit".into(), + archetype_field_name: Some("scaling".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.TensorViewFitIndicator".into(), - "rerun.blueprint.components.ViewFit".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorViewFit".into()), + component_name: "TensorViewFitIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorViewFit".into()), + component_name: "rerun.blueprint.components.ViewFit".into(), + archetype_field_name: Some("scaling".into()), + }, ] }); @@ -78,26 +86,26 @@ impl ::re_types_core::Archetype for TensorViewFit { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: TensorViewFitIndicator = TensorViewFitIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -131,9 +139,18 @@ impl ::re_types_core::AsComponents for TensorViewFit { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.scaling + (self + .scaling .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.TensorViewFit".into()), + archetype_field_name: Some(("scaling").into()), + component_name: ("rerun.blueprint.components.ViewFit").into(), + }), + }), ] .into_iter() .flatten() @@ -160,3 +177,15 @@ impl TensorViewFit { self } } + +impl ::re_types_core::SizeBytes for TensorViewFit { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.scaling.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/visible_time_ranges.rs b/crates/store/re_types/src/blueprint/archetypes/visible_time_ranges.rs index b817ee2a5799d..216190694e06a 100644 --- a/crates/store/re_types/src/blueprint/archetypes/visible_time_ranges.rs +++ b/crates/store/re_types/src/blueprint/archetypes/visible_time_ranges.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Configures what range of each timeline is shown on a view. @@ -35,32 +35,40 @@ pub struct VisibleTimeRanges { pub ranges: Vec, } -impl ::re_types_core::SizeBytes for VisibleTimeRanges { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.ranges.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.VisibleTimeRange".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisibleTimeRanges".into()), + component_name: "rerun.blueprint.components.VisibleTimeRange".into(), + archetype_field_name: Some("ranges".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.VisibleTimeRangesIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisibleTimeRanges".into()), + component_name: "VisibleTimeRangesIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.VisibleTimeRange".into(), - "rerun.blueprint.components.VisibleTimeRangesIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisibleTimeRanges".into()), + component_name: "rerun.blueprint.components.VisibleTimeRange".into(), + archetype_field_name: Some("ranges".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisibleTimeRanges".into()), + component_name: "VisibleTimeRangesIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -88,26 +96,26 @@ impl ::re_types_core::Archetype for VisibleTimeRanges { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: VisibleTimeRangesIndicator = VisibleTimeRangesIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -143,7 +151,16 @@ impl ::re_types_core::AsComponents for VisibleTimeRanges { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.ranges as &dyn ComponentBatch).into()), + (Some(&self.ranges as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisibleTimeRanges".into()), + archetype_field_name: Some(("ranges").into()), + component_name: ("rerun.blueprint.components.VisibleTimeRange").into(), + }), + } + }), ] .into_iter() .flatten() @@ -164,3 +181,15 @@ impl VisibleTimeRanges { } } } + +impl ::re_types_core::SizeBytes for VisibleTimeRanges { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.ranges.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs b/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs index f250112e93806..1c278e085f467 100644 --- a/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs +++ b/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Controls the visual bounds of a 2D view. @@ -33,32 +33,40 @@ pub struct VisualBounds2D { pub range: crate::blueprint::components::VisualBounds2D, } -impl ::re_types_core::SizeBytes for VisualBounds2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.range.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.VisualBounds2D".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), + component_name: "rerun.blueprint.components.VisualBounds2D".into(), + archetype_field_name: Some("range".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.VisualBounds2DIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), + component_name: "VisualBounds2DIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.VisualBounds2D".into(), - "rerun.blueprint.components.VisualBounds2DIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), + component_name: "rerun.blueprint.components.VisualBounds2D".into(), + archetype_field_name: Some("range".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), + component_name: "VisualBounds2DIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -86,26 +94,26 @@ impl ::re_types_core::Archetype for VisualBounds2D { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: VisualBounds2DIndicator = VisualBounds2DIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -142,7 +150,16 @@ impl ::re_types_core::AsComponents for VisualBounds2D { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.range as &dyn ComponentBatch).into()), + (Some(&self.range as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), + archetype_field_name: Some(("range").into()), + component_name: ("rerun.blueprint.components.VisualBounds2D").into(), + }), + } + }), ] .into_iter() .flatten() @@ -161,3 +178,15 @@ impl VisualBounds2D { } } } + +impl ::re_types_core::SizeBytes for VisualBounds2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.range.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/components/active_tab.rs b/crates/store/re_types/src/blueprint/components/active_tab.rs index 144cde6a26518..6da3162b2ab26 100644 --- a/crates/store/re_types/src/blueprint/components/active_tab.rs +++ b/crates/store/re_types/src/blueprint/components/active_tab.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The active tab in a tabbed container. @@ -27,15 +27,43 @@ pub struct ActiveTab( pub crate::datatypes::EntityPath, ); -impl ::re_types_core::SizeBytes for ActiveTab { +impl ::re_types_core::Component for ActiveTab { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ActiveTab") } +} +::re_types_core::macros::impl_into_cow!(ActiveTab); + +impl ::re_types_core::Loggable for ActiveTab { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::EntityPath::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::EntityPath::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::EntityPath::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -68,42 +96,14 @@ impl std::ops::DerefMut for ActiveTab { } } -::re_types_core::macros::impl_into_cow!(ActiveTab); - -impl ::re_types_core::Loggable for ActiveTab { +impl ::re_types_core::SizeBytes for ActiveTab { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::EntityPath::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::EntityPath::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::EntityPath::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for ActiveTab { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.ActiveTab".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/apply_latest_at.rs b/crates/store/re_types/src/blueprint/components/apply_latest_at.rs index 8afa9418e09f5..c1f420646a63c 100644 --- a/crates/store/re_types/src/blueprint/components/apply_latest_at.rs +++ b/crates/store/re_types/src/blueprint/components/apply_latest_at.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Whether empty cells in a dataframe should be filled with a latest-at query. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct ApplyLatestAt(pub crate::datatypes::Bool); -impl ::re_types_core::SizeBytes for ApplyLatestAt { +impl ::re_types_core::Component for ApplyLatestAt { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ApplyLatestAt") } +} +::re_types_core::macros::impl_into_cow!(ApplyLatestAt); + +impl ::re_types_core::Loggable for ApplyLatestAt { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for ApplyLatestAt { } } -::re_types_core::macros::impl_into_cow!(ApplyLatestAt); - -impl ::re_types_core::Loggable for ApplyLatestAt { +impl ::re_types_core::SizeBytes for ApplyLatestAt { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for ApplyLatestAt { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.ApplyLatestAt".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/background_kind.rs b/crates/store/re_types/src/blueprint/components/background_kind.rs index dd78ace0f99a7..2af6b2d58c762 100644 --- a/crates/store/re_types/src/blueprint/components/background_kind.rs +++ b/crates/store/re_types/src/blueprint/components/background_kind.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The type of the background in a view. @@ -38,45 +38,10 @@ pub enum BackgroundKind { SolidColor = 3, } -impl ::re_types_core::reflection::Enum for BackgroundKind { - #[inline] - fn variants() -> &'static [Self] { - &[Self::GradientDark, Self::GradientBright, Self::SolidColor] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::GradientDark => { - "A dark gradient.\n\nIn 3D views it changes depending on the direction of the view." - } - Self::GradientBright => { - "A bright gradient.\n\nIn 3D views it changes depending on the direction of the view." - } - Self::SolidColor => "Simple uniform color.", - } - } -} - -impl ::re_types_core::SizeBytes for BackgroundKind { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for BackgroundKind { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for BackgroundKind { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::GradientDark => write!(f, "GradientDark"), - Self::GradientBright => write!(f, "GradientBright"), - Self::SolidColor => write!(f, "SolidColor"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.BackgroundKind") } } @@ -167,9 +132,44 @@ impl ::re_types_core::Loggable for BackgroundKind { } } -impl ::re_types_core::Component for BackgroundKind { +impl std::fmt::Display for BackgroundKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::GradientDark => write!(f, "GradientDark"), + Self::GradientBright => write!(f, "GradientBright"), + Self::SolidColor => write!(f, "SolidColor"), + } + } +} + +impl ::re_types_core::reflection::Enum for BackgroundKind { + #[inline] + fn variants() -> &'static [Self] { + &[Self::GradientDark, Self::GradientBright, Self::SolidColor] + } + #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.BackgroundKind".into() + fn docstring_md(self) -> &'static str { + match self { + Self::GradientDark => { + "A dark gradient.\n\nIn 3D views it changes depending on the direction of the view." + } + Self::GradientBright => { + "A bright gradient.\n\nIn 3D views it changes depending on the direction of the view." + } + Self::SolidColor => "Simple uniform color.", + } + } +} + +impl ::re_types_core::SizeBytes for BackgroundKind { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/blueprint/components/column_share.rs b/crates/store/re_types/src/blueprint/components/column_share.rs index 130b7eab8eea7..1b3934bb438ab 100644 --- a/crates/store/re_types/src/blueprint/components/column_share.rs +++ b/crates/store/re_types/src/blueprint/components/column_share.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The layout share of a column in the container. @@ -25,44 +25,10 @@ pub struct ColumnShare( pub crate::datatypes::Float32, ); -impl ::re_types_core::SizeBytes for ColumnShare { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for ColumnShare { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for ColumnShare { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for ColumnShare { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for ColumnShare { +impl ::re_types_core::Component for ColumnShare { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ColumnShare") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for ColumnShare { } } -impl ::re_types_core::Component for ColumnShare { +impl> From for ColumnShare { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ColumnShare { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for ColumnShare { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for ColumnShare { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.ColumnShare".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ColumnShare { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/component_column_selector.rs b/crates/store/re_types/src/blueprint/components/component_column_selector.rs index a7e9de8c36688..3ee180d7faf89 100644 --- a/crates/store/re_types/src/blueprint/components/component_column_selector.rs +++ b/crates/store/re_types/src/blueprint/components/component_column_selector.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Describe a component column to be selected in the dataframe view. @@ -23,15 +23,45 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct ComponentColumnSelector(pub crate::blueprint::datatypes::ComponentColumnSelector); -impl ::re_types_core::SizeBytes for ComponentColumnSelector { +impl ::re_types_core::Component for ComponentColumnSelector { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ComponentColumnSelector") } +} +::re_types_core::macros::impl_into_cow!(ComponentColumnSelector); + +impl ::re_types_core::Loggable for ComponentColumnSelector { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::blueprint::datatypes::ComponentColumnSelector::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::blueprint::datatypes::ComponentColumnSelector::to_arrow_opt(data.into_iter().map( + |datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + }, + )) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::blueprint::datatypes::ComponentColumnSelector::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -68,44 +98,14 @@ impl std::ops::DerefMut for ComponentColumnSelector { } } -::re_types_core::macros::impl_into_cow!(ComponentColumnSelector); - -impl ::re_types_core::Loggable for ComponentColumnSelector { +impl ::re_types_core::SizeBytes for ComponentColumnSelector { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::blueprint::datatypes::ComponentColumnSelector::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::blueprint::datatypes::ComponentColumnSelector::to_arrow_opt(data.into_iter().map( - |datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - }, - )) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::blueprint::datatypes::ComponentColumnSelector::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for ComponentColumnSelector { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.ComponentColumnSelector".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/corner2d.rs b/crates/store/re_types/src/blueprint/components/corner2d.rs index 27e3fe2f0838b..474ca14c74f8d 100644 --- a/crates/store/re_types/src/blueprint/components/corner2d.rs +++ b/crates/store/re_types/src/blueprint/components/corner2d.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: One of four 2D corners, typically used to align objects. @@ -37,48 +37,10 @@ pub enum Corner2D { RightBottom = 4, } -impl ::re_types_core::reflection::Enum for Corner2D { - #[inline] - fn variants() -> &'static [Self] { - &[ - Self::LeftTop, - Self::RightTop, - Self::LeftBottom, - Self::RightBottom, - ] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::LeftTop => "Left top corner.", - Self::RightTop => "Right top corner.", - Self::LeftBottom => "Left bottom corner.", - Self::RightBottom => "Right bottom corner.", - } - } -} - -impl ::re_types_core::SizeBytes for Corner2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for Corner2D { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for Corner2D { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::LeftTop => write!(f, "LeftTop"), - Self::RightTop => write!(f, "RightTop"), - Self::LeftBottom => write!(f, "LeftBottom"), - Self::RightBottom => write!(f, "RightBottom"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.Corner2D") } } @@ -170,9 +132,47 @@ impl ::re_types_core::Loggable for Corner2D { } } -impl ::re_types_core::Component for Corner2D { +impl std::fmt::Display for Corner2D { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::LeftTop => write!(f, "LeftTop"), + Self::RightTop => write!(f, "RightTop"), + Self::LeftBottom => write!(f, "LeftBottom"), + Self::RightBottom => write!(f, "RightBottom"), + } + } +} + +impl ::re_types_core::reflection::Enum for Corner2D { + #[inline] + fn variants() -> &'static [Self] { + &[ + Self::LeftTop, + Self::RightTop, + Self::LeftBottom, + Self::RightBottom, + ] + } + #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.Corner2D".into() + fn docstring_md(self) -> &'static str { + match self { + Self::LeftTop => "Left top corner.", + Self::RightTop => "Right top corner.", + Self::LeftBottom => "Left bottom corner.", + Self::RightBottom => "Right bottom corner.", + } + } +} + +impl ::re_types_core::SizeBytes for Corner2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/blueprint/components/filter_by_range.rs b/crates/store/re_types/src/blueprint/components/filter_by_range.rs index f48e3f65fcc5e..79ac42d791dd2 100644 --- a/crates/store/re_types/src/blueprint/components/filter_by_range.rs +++ b/crates/store/re_types/src/blueprint/components/filter_by_range.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Configuration for a filter-by-range feature of the dataframe view. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct FilterByRange(pub crate::blueprint::datatypes::FilterByRange); -impl ::re_types_core::SizeBytes for FilterByRange { +impl ::re_types_core::Component for FilterByRange { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.FilterByRange") } +} +::re_types_core::macros::impl_into_cow!(FilterByRange); + +impl ::re_types_core::Loggable for FilterByRange { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::blueprint::datatypes::FilterByRange::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::blueprint::datatypes::FilterByRange::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::blueprint::datatypes::FilterByRange::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for FilterByRange { } } -::re_types_core::macros::impl_into_cow!(FilterByRange); - -impl ::re_types_core::Loggable for FilterByRange { +impl ::re_types_core::SizeBytes for FilterByRange { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::blueprint::datatypes::FilterByRange::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::blueprint::datatypes::FilterByRange::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::blueprint::datatypes::FilterByRange::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for FilterByRange { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.FilterByRange".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/filter_is_not_null.rs b/crates/store/re_types/src/blueprint/components/filter_is_not_null.rs index 47da6800b9588..54fe88bfbce6c 100644 --- a/crates/store/re_types/src/blueprint/components/filter_is_not_null.rs +++ b/crates/store/re_types/src/blueprint/components/filter_is_not_null.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Configuration for the filter is not null feature of the dataframe view. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct FilterIsNotNull(pub crate::blueprint::datatypes::FilterIsNotNull); -impl ::re_types_core::SizeBytes for FilterIsNotNull { +impl ::re_types_core::Component for FilterIsNotNull { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.FilterIsNotNull") } +} +::re_types_core::macros::impl_into_cow!(FilterIsNotNull); + +impl ::re_types_core::Loggable for FilterIsNotNull { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::blueprint::datatypes::FilterIsNotNull::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::blueprint::datatypes::FilterIsNotNull::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::blueprint::datatypes::FilterIsNotNull::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for FilterIsNotNull { } } -::re_types_core::macros::impl_into_cow!(FilterIsNotNull); - -impl ::re_types_core::Loggable for FilterIsNotNull { +impl ::re_types_core::SizeBytes for FilterIsNotNull { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::blueprint::datatypes::FilterIsNotNull::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::blueprint::datatypes::FilterIsNotNull::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::blueprint::datatypes::FilterIsNotNull::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for FilterIsNotNull { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.FilterIsNotNull".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/included_content.rs b/crates/store/re_types/src/blueprint/components/included_content.rs index 590900ece0ff0..7cb3fc26267cf 100644 --- a/crates/store/re_types/src/blueprint/components/included_content.rs +++ b/crates/store/re_types/src/blueprint/components/included_content.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: All the contents in the container. @@ -28,15 +28,43 @@ pub struct IncludedContent( pub crate::datatypes::EntityPath, ); -impl ::re_types_core::SizeBytes for IncludedContent { +impl ::re_types_core::Component for IncludedContent { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.IncludedContent") } +} +::re_types_core::macros::impl_into_cow!(IncludedContent); + +impl ::re_types_core::Loggable for IncludedContent { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::EntityPath::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::EntityPath::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::EntityPath::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -69,42 +97,14 @@ impl std::ops::DerefMut for IncludedContent { } } -::re_types_core::macros::impl_into_cow!(IncludedContent); - -impl ::re_types_core::Loggable for IncludedContent { +impl ::re_types_core::SizeBytes for IncludedContent { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::EntityPath::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::EntityPath::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::EntityPath::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for IncludedContent { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.IncludedContent".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/interactive.rs b/crates/store/re_types/src/blueprint/components/interactive.rs index a99f7505c0af5..571da85371096 100644 --- a/crates/store/re_types/src/blueprint/components/interactive.rs +++ b/crates/store/re_types/src/blueprint/components/interactive.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Whether the entity can be interacted with. @@ -25,15 +25,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Interactive(pub crate::datatypes::Bool); -impl ::re_types_core::SizeBytes for Interactive { +impl ::re_types_core::Component for Interactive { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.Interactive") } +} +::re_types_core::macros::impl_into_cow!(Interactive); + +impl ::re_types_core::Loggable for Interactive { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -66,42 +94,14 @@ impl std::ops::DerefMut for Interactive { } } -::re_types_core::macros::impl_into_cow!(Interactive); - -impl ::re_types_core::Loggable for Interactive { +impl ::re_types_core::SizeBytes for Interactive { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for Interactive { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.Interactive".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/lock_range_during_zoom.rs b/crates/store/re_types/src/blueprint/components/lock_range_during_zoom.rs index a0d60c1e2444b..379af14b6098d 100644 --- a/crates/store/re_types/src/blueprint/components/lock_range_during_zoom.rs +++ b/crates/store/re_types/src/blueprint/components/lock_range_during_zoom.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Indicate whether the range should be locked when zooming in on the data. @@ -25,15 +25,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct LockRangeDuringZoom(pub crate::datatypes::Bool); -impl ::re_types_core::SizeBytes for LockRangeDuringZoom { +impl ::re_types_core::Component for LockRangeDuringZoom { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.LockRangeDuringZoom") } +} +::re_types_core::macros::impl_into_cow!(LockRangeDuringZoom); + +impl ::re_types_core::Loggable for LockRangeDuringZoom { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -66,42 +94,14 @@ impl std::ops::DerefMut for LockRangeDuringZoom { } } -::re_types_core::macros::impl_into_cow!(LockRangeDuringZoom); - -impl ::re_types_core::Loggable for LockRangeDuringZoom { +impl ::re_types_core::SizeBytes for LockRangeDuringZoom { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for LockRangeDuringZoom { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.LockRangeDuringZoom".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/map_provider.rs b/crates/store/re_types/src/blueprint/components/map_provider.rs index ada45a3f9463c..079dbdc009e81 100644 --- a/crates/store/re_types/src/blueprint/components/map_provider.rs +++ b/crates/store/re_types/src/blueprint/components/map_provider.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Name of the map provider to be used in Map views. @@ -37,48 +37,10 @@ pub enum MapProvider { MapboxSatellite = 4, } -impl ::re_types_core::reflection::Enum for MapProvider { - #[inline] - fn variants() -> &'static [Self] { - &[ - Self::OpenStreetMap, - Self::MapboxStreets, - Self::MapboxDark, - Self::MapboxSatellite, - ] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::OpenStreetMap => "`OpenStreetMap` is the default map provider.", - Self::MapboxStreets => "Mapbox Streets is a minimalistic map designed by Mapbox.", - Self::MapboxDark => "Mapbox Dark is a dark-themed map designed by Mapbox.", - Self::MapboxSatellite => "Mapbox Satellite is a satellite map designed by Mapbox.", - } - } -} - -impl ::re_types_core::SizeBytes for MapProvider { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for MapProvider { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for MapProvider { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::OpenStreetMap => write!(f, "OpenStreetMap"), - Self::MapboxStreets => write!(f, "MapboxStreets"), - Self::MapboxDark => write!(f, "MapboxDark"), - Self::MapboxSatellite => write!(f, "MapboxSatellite"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.MapProvider") } } @@ -170,9 +132,47 @@ impl ::re_types_core::Loggable for MapProvider { } } -impl ::re_types_core::Component for MapProvider { +impl std::fmt::Display for MapProvider { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::OpenStreetMap => write!(f, "OpenStreetMap"), + Self::MapboxStreets => write!(f, "MapboxStreets"), + Self::MapboxDark => write!(f, "MapboxDark"), + Self::MapboxSatellite => write!(f, "MapboxSatellite"), + } + } +} + +impl ::re_types_core::reflection::Enum for MapProvider { + #[inline] + fn variants() -> &'static [Self] { + &[ + Self::OpenStreetMap, + Self::MapboxStreets, + Self::MapboxDark, + Self::MapboxSatellite, + ] + } + #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.MapProvider".into() + fn docstring_md(self) -> &'static str { + match self { + Self::OpenStreetMap => "`OpenStreetMap` is the default map provider.", + Self::MapboxStreets => "Mapbox Streets is a minimalistic map designed by Mapbox.", + Self::MapboxDark => "Mapbox Dark is a dark-themed map designed by Mapbox.", + Self::MapboxSatellite => "Mapbox Satellite is a satellite map designed by Mapbox.", + } + } +} + +impl ::re_types_core::SizeBytes for MapProvider { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/blueprint/components/panel_state.rs b/crates/store/re_types/src/blueprint/components/panel_state.rs index 7b19e5ec31f5a..b398287f885ae 100644 --- a/crates/store/re_types/src/blueprint/components/panel_state.rs +++ b/crates/store/re_types/src/blueprint/components/panel_state.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Tri-state for panel controls. @@ -34,41 +34,10 @@ pub enum PanelState { Expanded = 3, } -impl ::re_types_core::reflection::Enum for PanelState { - #[inline] - fn variants() -> &'static [Self] { - &[Self::Hidden, Self::Collapsed, Self::Expanded] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Hidden => "Completely hidden.", - Self::Collapsed => "Visible, but as small as possible on its shorter axis.", - Self::Expanded => "Fully expanded.", - } - } -} - -impl ::re_types_core::SizeBytes for PanelState { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for PanelState { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for PanelState { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Hidden => write!(f, "Hidden"), - Self::Collapsed => write!(f, "Collapsed"), - Self::Expanded => write!(f, "Expanded"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.PanelState") } } @@ -159,9 +128,40 @@ impl ::re_types_core::Loggable for PanelState { } } -impl ::re_types_core::Component for PanelState { +impl std::fmt::Display for PanelState { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Hidden => write!(f, "Hidden"), + Self::Collapsed => write!(f, "Collapsed"), + Self::Expanded => write!(f, "Expanded"), + } + } +} + +impl ::re_types_core::reflection::Enum for PanelState { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.PanelState".into() + fn variants() -> &'static [Self] { + &[Self::Hidden, Self::Collapsed, Self::Expanded] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::Hidden => "Completely hidden.", + Self::Collapsed => "Visible, but as small as possible on its shorter axis.", + Self::Expanded => "Fully expanded.", + } + } +} + +impl ::re_types_core::SizeBytes for PanelState { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/blueprint/components/query_expression.rs b/crates/store/re_types/src/blueprint/components/query_expression.rs index ec60f3a0a29d4..04c9900ed7384 100644 --- a/crates/store/re_types/src/blueprint/components/query_expression.rs +++ b/crates/store/re_types/src/blueprint/components/query_expression.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: An individual query expression used to filter a set of [`datatypes::EntityPath`][crate::datatypes::EntityPath]s. @@ -32,15 +32,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct QueryExpression(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for QueryExpression { +impl ::re_types_core::Component for QueryExpression { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.QueryExpression") } +} +::re_types_core::macros::impl_into_cow!(QueryExpression); + +impl ::re_types_core::Loggable for QueryExpression { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -73,42 +101,14 @@ impl std::ops::DerefMut for QueryExpression { } } -::re_types_core::macros::impl_into_cow!(QueryExpression); - -impl ::re_types_core::Loggable for QueryExpression { +impl ::re_types_core::SizeBytes for QueryExpression { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for QueryExpression { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.QueryExpression".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/row_share.rs b/crates/store/re_types/src/blueprint/components/row_share.rs index 2b70f7fe32bfa..227c59dd9e208 100644 --- a/crates/store/re_types/src/blueprint/components/row_share.rs +++ b/crates/store/re_types/src/blueprint/components/row_share.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The layout share of a row in the container. @@ -25,44 +25,10 @@ pub struct RowShare( pub crate::datatypes::Float32, ); -impl ::re_types_core::SizeBytes for RowShare { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for RowShare { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for RowShare { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for RowShare { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for RowShare { +impl ::re_types_core::Component for RowShare { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.RowShare") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for RowShare { } } -impl ::re_types_core::Component for RowShare { +impl> From for RowShare { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for RowShare { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for RowShare { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for RowShare { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.RowShare".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for RowShare { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/selected_columns.rs b/crates/store/re_types/src/blueprint/components/selected_columns.rs index 83b30d1acc1b1..004fdec11e17e 100644 --- a/crates/store/re_types/src/blueprint/components/selected_columns.rs +++ b/crates/store/re_types/src/blueprint/components/selected_columns.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Describe a component column to be selected in the dataframe view. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct SelectedColumns(pub crate::blueprint::datatypes::SelectedColumns); -impl ::re_types_core::SizeBytes for SelectedColumns { +impl ::re_types_core::Component for SelectedColumns { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.SelectedColumns") } +} +::re_types_core::macros::impl_into_cow!(SelectedColumns); + +impl ::re_types_core::Loggable for SelectedColumns { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::blueprint::datatypes::SelectedColumns::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::blueprint::datatypes::SelectedColumns::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::blueprint::datatypes::SelectedColumns::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for SelectedColumns { } } -::re_types_core::macros::impl_into_cow!(SelectedColumns); - -impl ::re_types_core::Loggable for SelectedColumns { +impl ::re_types_core::SizeBytes for SelectedColumns { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::blueprint::datatypes::SelectedColumns::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::blueprint::datatypes::SelectedColumns::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::blueprint::datatypes::SelectedColumns::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for SelectedColumns { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.SelectedColumns".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/space_view_class.rs b/crates/store/re_types/src/blueprint/components/space_view_class.rs index 6e0c0cf363c27..25777485cb18d 100644 --- a/crates/store/re_types/src/blueprint/components/space_view_class.rs +++ b/crates/store/re_types/src/blueprint/components/space_view_class.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The class identifier of view, e.g. `"2D"`, `"TextLog"`, …. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct SpaceViewClass(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for SpaceViewClass { +impl ::re_types_core::Component for SpaceViewClass { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.SpaceViewClass") } +} +::re_types_core::macros::impl_into_cow!(SpaceViewClass); + +impl ::re_types_core::Loggable for SpaceViewClass { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for SpaceViewClass { } } -::re_types_core::macros::impl_into_cow!(SpaceViewClass); - -impl ::re_types_core::Loggable for SpaceViewClass { +impl ::re_types_core::SizeBytes for SpaceViewClass { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for SpaceViewClass { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.SpaceViewClass".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/space_view_origin.rs b/crates/store/re_types/src/blueprint/components/space_view_origin.rs index 82e0ecf6e1551..abed60a650607 100644 --- a/crates/store/re_types/src/blueprint/components/space_view_origin.rs +++ b/crates/store/re_types/src/blueprint/components/space_view_origin.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The origin of a `SpaceView`. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct SpaceViewOrigin(pub crate::datatypes::EntityPath); -impl ::re_types_core::SizeBytes for SpaceViewOrigin { +impl ::re_types_core::Component for SpaceViewOrigin { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.SpaceViewOrigin") } +} +::re_types_core::macros::impl_into_cow!(SpaceViewOrigin); + +impl ::re_types_core::Loggable for SpaceViewOrigin { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::EntityPath::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::EntityPath::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::EntityPath::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for SpaceViewOrigin { } } -::re_types_core::macros::impl_into_cow!(SpaceViewOrigin); - -impl ::re_types_core::Loggable for SpaceViewOrigin { +impl ::re_types_core::SizeBytes for SpaceViewOrigin { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::EntityPath::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::EntityPath::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::EntityPath::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for SpaceViewOrigin { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.SpaceViewOrigin".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/tensor_dimension_index_slider.rs b/crates/store/re_types/src/blueprint/components/tensor_dimension_index_slider.rs index 350db3ae3dff1..b6d635eea1cc9 100644 --- a/crates/store/re_types/src/blueprint/components/tensor_dimension_index_slider.rs +++ b/crates/store/re_types/src/blueprint/components/tensor_dimension_index_slider.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Show a slider for the index of some dimension of a slider. @@ -23,15 +23,45 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TensorDimensionIndexSlider(pub crate::blueprint::datatypes::TensorDimensionIndexSlider); -impl ::re_types_core::SizeBytes for TensorDimensionIndexSlider { +impl ::re_types_core::Component for TensorDimensionIndexSlider { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.TensorDimensionIndexSlider") } +} +::re_types_core::macros::impl_into_cow!(TensorDimensionIndexSlider); + +impl ::re_types_core::Loggable for TensorDimensionIndexSlider { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::blueprint::datatypes::TensorDimensionIndexSlider::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::blueprint::datatypes::TensorDimensionIndexSlider::to_arrow_opt(data.into_iter().map( + |datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + }, + )) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::blueprint::datatypes::TensorDimensionIndexSlider::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -68,44 +98,14 @@ impl std::ops::DerefMut for TensorDimensionIndexSlider { } } -::re_types_core::macros::impl_into_cow!(TensorDimensionIndexSlider); - -impl ::re_types_core::Loggable for TensorDimensionIndexSlider { +impl ::re_types_core::SizeBytes for TensorDimensionIndexSlider { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::blueprint::datatypes::TensorDimensionIndexSlider::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::blueprint::datatypes::TensorDimensionIndexSlider::to_arrow_opt(data.into_iter().map( - |datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - }, - )) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::blueprint::datatypes::TensorDimensionIndexSlider::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for TensorDimensionIndexSlider { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.TensorDimensionIndexSlider".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/timeline_name.rs b/crates/store/re_types/src/blueprint/components/timeline_name.rs index fd7ebbe0398f5..4ee740d2ccf42 100644 --- a/crates/store/re_types/src/blueprint/components/timeline_name.rs +++ b/crates/store/re_types/src/blueprint/components/timeline_name.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A timeline identified by its name. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TimelineName(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for TimelineName { +impl ::re_types_core::Component for TimelineName { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.TimelineName") } +} +::re_types_core::macros::impl_into_cow!(TimelineName); + +impl ::re_types_core::Loggable for TimelineName { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for TimelineName { } } -::re_types_core::macros::impl_into_cow!(TimelineName); - -impl ::re_types_core::Loggable for TimelineName { +impl ::re_types_core::SizeBytes for TimelineName { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for TimelineName { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.TimelineName".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/view_fit.rs b/crates/store/re_types/src/blueprint/components/view_fit.rs index 90711dc0d3913..92230e2a88219 100644 --- a/crates/store/re_types/src/blueprint/components/view_fit.rs +++ b/crates/store/re_types/src/blueprint/components/view_fit.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Determines whether an image or texture should be scaled to fit the viewport. @@ -34,47 +34,10 @@ pub enum ViewFit { FillKeepAspectRatio = 3, } -impl ::re_types_core::reflection::Enum for ViewFit { - #[inline] - fn variants() -> &'static [Self] { - &[Self::Original, Self::Fill, Self::FillKeepAspectRatio] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Original => { - "No scaling, pixel size will match the image's width/height dimensions in pixels." - } - Self::Fill => { - "Scale the image for the largest possible fit in the view's container." - } - Self::FillKeepAspectRatio => { - "Scale the image for the largest possible fit in the view's container, but keep the original aspect ratio." - } - } - } -} - -impl ::re_types_core::SizeBytes for ViewFit { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for ViewFit { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for ViewFit { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Original => write!(f, "Original"), - Self::Fill => write!(f, "Fill"), - Self::FillKeepAspectRatio => write!(f, "FillKeepAspectRatio"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ViewFit") } } @@ -165,9 +128,46 @@ impl ::re_types_core::Loggable for ViewFit { } } -impl ::re_types_core::Component for ViewFit { +impl std::fmt::Display for ViewFit { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Original => write!(f, "Original"), + Self::Fill => write!(f, "Fill"), + Self::FillKeepAspectRatio => write!(f, "FillKeepAspectRatio"), + } + } +} + +impl ::re_types_core::reflection::Enum for ViewFit { + #[inline] + fn variants() -> &'static [Self] { + &[Self::Original, Self::Fill, Self::FillKeepAspectRatio] + } + #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.ViewFit".into() + fn docstring_md(self) -> &'static str { + match self { + Self::Original => { + "No scaling, pixel size will match the image's width/height dimensions in pixels." + } + Self::Fill => { + "Scale the image for the largest possible fit in the view's container." + } + Self::FillKeepAspectRatio => { + "Scale the image for the largest possible fit in the view's container, but keep the original aspect ratio." + } + } + } +} + +impl ::re_types_core::SizeBytes for ViewFit { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/blueprint/components/viewer_recommendation_hash.rs b/crates/store/re_types/src/blueprint/components/viewer_recommendation_hash.rs index c52a0f6137ca5..bb1ae7f469b6b 100644 --- a/crates/store/re_types/src/blueprint/components/viewer_recommendation_hash.rs +++ b/crates/store/re_types/src/blueprint/components/viewer_recommendation_hash.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Hash of a viewer recommendation. @@ -25,44 +25,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct ViewerRecommendationHash(pub crate::datatypes::UInt64); -impl ::re_types_core::SizeBytes for ViewerRecommendationHash { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for ViewerRecommendationHash { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for ViewerRecommendationHash { - #[inline] - fn borrow(&self) -> &crate::datatypes::UInt64 { - &self.0 - } -} - -impl std::ops::Deref for ViewerRecommendationHash { - type Target = crate::datatypes::UInt64; - - #[inline] - fn deref(&self) -> &crate::datatypes::UInt64 { - &self.0 - } -} - -impl std::ops::DerefMut for ViewerRecommendationHash { +impl ::re_types_core::Component for ViewerRecommendationHash { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::UInt64 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ViewerRecommendationHash") } } @@ -107,9 +73,43 @@ impl ::re_types_core::Loggable for ViewerRecommendationHash { } } -impl ::re_types_core::Component for ViewerRecommendationHash { +impl> From for ViewerRecommendationHash { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ViewerRecommendationHash { + #[inline] + fn borrow(&self) -> &crate::datatypes::UInt64 { + &self.0 + } +} + +impl std::ops::Deref for ViewerRecommendationHash { + type Target = crate::datatypes::UInt64; + + #[inline] + fn deref(&self) -> &crate::datatypes::UInt64 { + &self.0 + } +} + +impl std::ops::DerefMut for ViewerRecommendationHash { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.ViewerRecommendationHash".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::UInt64 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ViewerRecommendationHash { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/visible.rs b/crates/store/re_types/src/blueprint/components/visible.rs index 372c85ca7cfe8..85250896eb37b 100644 --- a/crates/store/re_types/src/blueprint/components/visible.rs +++ b/crates/store/re_types/src/blueprint/components/visible.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Whether the container, view, entity or instance is currently visible. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Visible(pub crate::datatypes::Bool); -impl ::re_types_core::SizeBytes for Visible { +impl ::re_types_core::Component for Visible { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.Visible") } +} +::re_types_core::macros::impl_into_cow!(Visible); + +impl ::re_types_core::Loggable for Visible { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for Visible { } } -::re_types_core::macros::impl_into_cow!(Visible); - -impl ::re_types_core::Loggable for Visible { +impl ::re_types_core::SizeBytes for Visible { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for Visible { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.Visible".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/visible_time_range.rs b/crates/store/re_types/src/blueprint/components/visible_time_range.rs index 2875854faf723..28d21efab1d4d 100644 --- a/crates/store/re_types/src/blueprint/components/visible_time_range.rs +++ b/crates/store/re_types/src/blueprint/components/visible_time_range.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The range of values on a given timeline that will be included in a view's query. @@ -25,15 +25,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct VisibleTimeRange(pub crate::datatypes::VisibleTimeRange); -impl ::re_types_core::SizeBytes for VisibleTimeRange { +impl ::re_types_core::Component for VisibleTimeRange { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.VisibleTimeRange") } +} +::re_types_core::macros::impl_into_cow!(VisibleTimeRange); + +impl ::re_types_core::Loggable for VisibleTimeRange { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::VisibleTimeRange::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::VisibleTimeRange::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::VisibleTimeRange::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -66,42 +94,14 @@ impl std::ops::DerefMut for VisibleTimeRange { } } -::re_types_core::macros::impl_into_cow!(VisibleTimeRange); - -impl ::re_types_core::Loggable for VisibleTimeRange { +impl ::re_types_core::SizeBytes for VisibleTimeRange { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::VisibleTimeRange::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::VisibleTimeRange::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::VisibleTimeRange::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for VisibleTimeRange { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.VisibleTimeRange".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/visual_bounds2d.rs b/crates/store/re_types/src/blueprint/components/visual_bounds2d.rs index e5355ecb9d5c5..216b8ee798e93 100644 --- a/crates/store/re_types/src/blueprint/components/visual_bounds2d.rs +++ b/crates/store/re_types/src/blueprint/components/visual_bounds2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Visual bounds in 2D space used for `Spatial2DView`. @@ -26,15 +26,43 @@ pub struct VisualBounds2D( pub crate::datatypes::Range2D, ); -impl ::re_types_core::SizeBytes for VisualBounds2D { +impl ::re_types_core::Component for VisualBounds2D { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.VisualBounds2D") } +} +::re_types_core::macros::impl_into_cow!(VisualBounds2D); + +impl ::re_types_core::Loggable for VisualBounds2D { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Range2D::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Range2D::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Range2D::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -67,42 +95,14 @@ impl std::ops::DerefMut for VisualBounds2D { } } -::re_types_core::macros::impl_into_cow!(VisualBounds2D); - -impl ::re_types_core::Loggable for VisualBounds2D { +impl ::re_types_core::SizeBytes for VisualBounds2D { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Range2D::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Range2D::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Range2D::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for VisualBounds2D { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.VisualBounds2D".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/zoom_level.rs b/crates/store/re_types/src/blueprint/components/zoom_level.rs index 1708693a90b5a..313abcbda152f 100644 --- a/crates/store/re_types/src/blueprint/components/zoom_level.rs +++ b/crates/store/re_types/src/blueprint/components/zoom_level.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A zoom level determines how much of the world is visible on a map. @@ -25,44 +25,10 @@ pub struct ZoomLevel( pub crate::datatypes::Float64, ); -impl ::re_types_core::SizeBytes for ZoomLevel { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for ZoomLevel { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for ZoomLevel { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float64 { - &self.0 - } -} - -impl std::ops::Deref for ZoomLevel { - type Target = crate::datatypes::Float64; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float64 { - &self.0 - } -} - -impl std::ops::DerefMut for ZoomLevel { +impl ::re_types_core::Component for ZoomLevel { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float64 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ZoomLevel") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for ZoomLevel { } } -impl ::re_types_core::Component for ZoomLevel { +impl> From for ZoomLevel { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ZoomLevel { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float64 { + &self.0 + } +} + +impl std::ops::Deref for ZoomLevel { + type Target = crate::datatypes::Float64; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float64 { + &self.0 + } +} + +impl std::ops::DerefMut for ZoomLevel { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.ZoomLevel".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float64 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ZoomLevel { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/datatypes/component_column_selector.rs b/crates/store/re_types/src/blueprint/datatypes/component_column_selector.rs index aa2f8ff6408f4..efc6eb3fa15c3 100644 --- a/crates/store/re_types/src/blueprint/datatypes/component_column_selector.rs +++ b/crates/store/re_types/src/blueprint/datatypes/component_column_selector.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Describe a component column to be selected in the dataframe view. @@ -28,18 +28,6 @@ pub struct ComponentColumnSelector { pub component: crate::datatypes::Utf8, } -impl ::re_types_core::SizeBytes for ComponentColumnSelector { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.entity_path.heap_size_bytes() + self.component.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(ComponentColumnSelector); impl ::re_types_core::Loggable for ComponentColumnSelector { @@ -347,3 +335,15 @@ impl ::re_types_core::Loggable for ComponentColumnSelector { }) } } + +impl ::re_types_core::SizeBytes for ComponentColumnSelector { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.entity_path.heap_size_bytes() + self.component.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/datatypes/filter_by_range.rs b/crates/store/re_types/src/blueprint/datatypes/filter_by_range.rs index 5387426ba1469..a0c0c9444741d 100644 --- a/crates/store/re_types/src/blueprint/datatypes/filter_by_range.rs +++ b/crates/store/re_types/src/blueprint/datatypes/filter_by_range.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Configuration for the filter-by-range feature of the dataframe view. @@ -28,18 +28,6 @@ pub struct FilterByRange { pub end: crate::datatypes::TimeInt, } -impl ::re_types_core::SizeBytes for FilterByRange { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.start.heap_size_bytes() + self.end.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(FilterByRange); impl ::re_types_core::Loggable for FilterByRange { @@ -241,3 +229,15 @@ impl ::re_types_core::Loggable for FilterByRange { }) } } + +impl ::re_types_core::SizeBytes for FilterByRange { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.start.heap_size_bytes() + self.end.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/datatypes/filter_is_not_null.rs b/crates/store/re_types/src/blueprint/datatypes/filter_is_not_null.rs index 5a481196232ae..a4ee6292e1d90 100644 --- a/crates/store/re_types/src/blueprint/datatypes/filter_is_not_null.rs +++ b/crates/store/re_types/src/blueprint/datatypes/filter_is_not_null.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Configuration for the filter is not null feature of the dataframe view. @@ -28,19 +28,6 @@ pub struct FilterIsNotNull { pub column: crate::blueprint::datatypes::ComponentColumnSelector, } -impl ::re_types_core::SizeBytes for FilterIsNotNull { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.active.heap_size_bytes() + self.column.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(FilterIsNotNull); impl ::re_types_core::Loggable for FilterIsNotNull { @@ -232,3 +219,16 @@ impl ::re_types_core::Loggable for FilterIsNotNull { }) } } + +impl ::re_types_core::SizeBytes for FilterIsNotNull { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.active.heap_size_bytes() + self.column.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/datatypes/selected_columns.rs b/crates/store/re_types/src/blueprint/datatypes/selected_columns.rs index cff91ae89b293..c74068f8d3eb8 100644 --- a/crates/store/re_types/src/blueprint/datatypes/selected_columns.rs +++ b/crates/store/re_types/src/blueprint/datatypes/selected_columns.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: List of selected columns in a dataframe. @@ -28,19 +28,6 @@ pub struct SelectedColumns { pub component_columns: Vec, } -impl ::re_types_core::SizeBytes for SelectedColumns { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.time_columns.heap_size_bytes() + self.component_columns.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(SelectedColumns); impl ::re_types_core::Loggable for SelectedColumns { @@ -469,3 +456,16 @@ impl ::re_types_core::Loggable for SelectedColumns { }) } } + +impl ::re_types_core::SizeBytes for SelectedColumns { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.time_columns.heap_size_bytes() + self.component_columns.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/datatypes/tensor_dimension_index_slider.rs b/crates/store/re_types/src/blueprint/datatypes/tensor_dimension_index_slider.rs index 0a8bf5693d078..bd05f871e0f14 100644 --- a/crates/store/re_types/src/blueprint/datatypes/tensor_dimension_index_slider.rs +++ b/crates/store/re_types/src/blueprint/datatypes/tensor_dimension_index_slider.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Defines a slider for the index of some dimension. @@ -25,32 +25,6 @@ pub struct TensorDimensionIndexSlider { pub dimension: u32, } -impl ::re_types_core::SizeBytes for TensorDimensionIndexSlider { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.dimension.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for TensorDimensionIndexSlider { - #[inline] - fn from(dimension: u32) -> Self { - Self { dimension } - } -} - -impl From for u32 { - #[inline] - fn from(value: TensorDimensionIndexSlider) -> Self { - value.dimension - } -} - ::re_types_core::macros::impl_into_cow!(TensorDimensionIndexSlider); impl ::re_types_core::Loggable for TensorDimensionIndexSlider { @@ -197,3 +171,29 @@ impl ::re_types_core::Loggable for TensorDimensionIndexSlider { }) } } + +impl From for TensorDimensionIndexSlider { + #[inline] + fn from(dimension: u32) -> Self { + Self { dimension } + } +} + +impl From for u32 { + #[inline] + fn from(value: TensorDimensionIndexSlider) -> Self { + value.dimension + } +} + +impl ::re_types_core::SizeBytes for TensorDimensionIndexSlider { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.dimension.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/views/bar_chart_view.rs b/crates/store/re_types/src/blueprint/views/bar_chart_view.rs index 9be05477731d0..4186a7836bbc9 100644 --- a/crates/store/re_types/src/blueprint/views/bar_chart_view.rs +++ b/crates/store/re_types/src/blueprint/views/bar_chart_view.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: A bar chart view. @@ -25,15 +25,10 @@ pub struct BarChartView { pub plot_legend: crate::blueprint::archetypes::PlotLegend, } -impl ::re_types_core::SizeBytes for BarChartView { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.plot_legend.heap_size_bytes() - } - +impl ::re_types_core::View for BarChartView { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "BarChart".into() } } @@ -68,9 +63,14 @@ impl std::ops::DerefMut for BarChartView { } } -impl ::re_types_core::View for BarChartView { +impl ::re_types_core::SizeBytes for BarChartView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "BarChart".into() + fn heap_size_bytes(&self) -> u64 { + self.plot_legend.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/views/dataframe_view.rs b/crates/store/re_types/src/blueprint/views/dataframe_view.rs index bcf2398d2efd6..8f661db346c60 100644 --- a/crates/store/re_types/src/blueprint/views/dataframe_view.rs +++ b/crates/store/re_types/src/blueprint/views/dataframe_view.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: A view to display any data in a tabular form. @@ -27,15 +27,10 @@ pub struct DataframeView { pub query: crate::blueprint::archetypes::DataframeQuery, } -impl ::re_types_core::SizeBytes for DataframeView { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.query.heap_size_bytes() - } - +impl ::re_types_core::View for DataframeView { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "Dataframe".into() } } @@ -68,9 +63,14 @@ impl std::ops::DerefMut for DataframeView { } } -impl ::re_types_core::View for DataframeView { +impl ::re_types_core::SizeBytes for DataframeView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "Dataframe".into() + fn heap_size_bytes(&self) -> u64 { + self.query.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/views/graph_view.rs b/crates/store/re_types/src/blueprint/views/graph_view.rs index 505d5efd40d13..c1fdf10aa5c31 100644 --- a/crates/store/re_types/src/blueprint/views/graph_view.rs +++ b/crates/store/re_types/src/blueprint/views/graph_view.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: A graph view to display time-variying, directed or undirected graph visualization. @@ -27,15 +27,10 @@ pub struct GraphView { pub visual_bounds: crate::blueprint::archetypes::VisualBounds2D, } -impl ::re_types_core::SizeBytes for GraphView { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.visual_bounds.heap_size_bytes() - } - +impl ::re_types_core::View for GraphView { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "Graph".into() } } @@ -70,9 +65,14 @@ impl std::ops::DerefMut for GraphView { } } -impl ::re_types_core::View for GraphView { +impl ::re_types_core::SizeBytes for GraphView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "Graph".into() + fn heap_size_bytes(&self) -> u64 { + self.visual_bounds.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/views/map_view.rs b/crates/store/re_types/src/blueprint/views/map_view.rs index abb5247024187..308bc45e286be 100644 --- a/crates/store/re_types/src/blueprint/views/map_view.rs +++ b/crates/store/re_types/src/blueprint/views/map_view.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: A 2D map view to display geospatial primitives. @@ -28,6 +28,13 @@ pub struct MapView { pub background: crate::blueprint::archetypes::MapBackground, } +impl ::re_types_core::View for MapView { + #[inline] + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "Map".into() + } +} + impl ::re_types_core::SizeBytes for MapView { #[inline] fn heap_size_bytes(&self) -> u64 { @@ -40,10 +47,3 @@ impl ::re_types_core::SizeBytes for MapView { && ::is_pod() } } - -impl ::re_types_core::View for MapView { - #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "Map".into() - } -} diff --git a/crates/store/re_types/src/blueprint/views/spatial2d_view.rs b/crates/store/re_types/src/blueprint/views/spatial2d_view.rs index dd6178a8fb91e..46ba80e4ce3ee 100644 --- a/crates/store/re_types/src/blueprint/views/spatial2d_view.rs +++ b/crates/store/re_types/src/blueprint/views/spatial2d_view.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: For viewing spatial 2D data. @@ -37,6 +37,13 @@ pub struct Spatial2DView { pub time_ranges: crate::blueprint::archetypes::VisibleTimeRanges, } +impl ::re_types_core::View for Spatial2DView { + #[inline] + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "2D".into() + } +} + impl ::re_types_core::SizeBytes for Spatial2DView { #[inline] fn heap_size_bytes(&self) -> u64 { @@ -52,10 +59,3 @@ impl ::re_types_core::SizeBytes for Spatial2DView { && ::is_pod() } } - -impl ::re_types_core::View for Spatial2DView { - #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "2D".into() - } -} diff --git a/crates/store/re_types/src/blueprint/views/spatial3d_view.rs b/crates/store/re_types/src/blueprint/views/spatial3d_view.rs index 7eb491d3334f6..d190db2445839 100644 --- a/crates/store/re_types/src/blueprint/views/spatial3d_view.rs +++ b/crates/store/re_types/src/blueprint/views/spatial3d_view.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: For viewing spatial 3D data. @@ -31,6 +31,13 @@ pub struct Spatial3DView { pub time_ranges: crate::blueprint::archetypes::VisibleTimeRanges, } +impl ::re_types_core::View for Spatial3DView { + #[inline] + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "3D".into() + } +} + impl ::re_types_core::SizeBytes for Spatial3DView { #[inline] fn heap_size_bytes(&self) -> u64 { @@ -43,10 +50,3 @@ impl ::re_types_core::SizeBytes for Spatial3DView { && ::is_pod() } } - -impl ::re_types_core::View for Spatial3DView { - #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "3D".into() - } -} diff --git a/crates/store/re_types/src/blueprint/views/tensor_view.rs b/crates/store/re_types/src/blueprint/views/tensor_view.rs index de11c2e91736c..46fb9817a8308 100644 --- a/crates/store/re_types/src/blueprint/views/tensor_view.rs +++ b/crates/store/re_types/src/blueprint/views/tensor_view.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: A view on a tensor of any dimensionality. @@ -31,6 +31,13 @@ pub struct TensorView { pub view_fit: crate::blueprint::archetypes::TensorViewFit, } +impl ::re_types_core::View for TensorView { + #[inline] + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "Tensor".into() + } +} + impl ::re_types_core::SizeBytes for TensorView { #[inline] fn heap_size_bytes(&self) -> u64 { @@ -46,10 +53,3 @@ impl ::re_types_core::SizeBytes for TensorView { && ::is_pod() } } - -impl ::re_types_core::View for TensorView { - #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "Tensor".into() - } -} diff --git a/crates/store/re_types/src/blueprint/views/text_document_view.rs b/crates/store/re_types/src/blueprint/views/text_document_view.rs index 01d7cb7126dc9..875d549c4751a 100644 --- a/crates/store/re_types/src/blueprint/views/text_document_view.rs +++ b/crates/store/re_types/src/blueprint/views/text_document_view.rs @@ -13,15 +13,22 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: A view of a single text document, for use with [`archetypes::TextDocument`][crate::archetypes::TextDocument]. #[derive(Clone, Debug)] pub struct TextDocumentView {} +impl ::re_types_core::View for TextDocumentView { + #[inline] + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "TextDocument".into() + } +} + impl ::re_types_core::SizeBytes for TextDocumentView { #[inline] fn heap_size_bytes(&self) -> u64 { @@ -33,10 +40,3 @@ impl ::re_types_core::SizeBytes for TextDocumentView { true } } - -impl ::re_types_core::View for TextDocumentView { - #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "TextDocument".into() - } -} diff --git a/crates/store/re_types/src/blueprint/views/text_log_view.rs b/crates/store/re_types/src/blueprint/views/text_log_view.rs index d71fbf9ef3b63..eabdce45ee6bf 100644 --- a/crates/store/re_types/src/blueprint/views/text_log_view.rs +++ b/crates/store/re_types/src/blueprint/views/text_log_view.rs @@ -13,15 +13,22 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: A view of a text log, for use with [`archetypes::TextLog`][crate::archetypes::TextLog]. #[derive(Clone, Debug)] pub struct TextLogView {} +impl ::re_types_core::View for TextLogView { + #[inline] + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "TextLog".into() + } +} + impl ::re_types_core::SizeBytes for TextLogView { #[inline] fn heap_size_bytes(&self) -> u64 { @@ -33,10 +40,3 @@ impl ::re_types_core::SizeBytes for TextLogView { true } } - -impl ::re_types_core::View for TextLogView { - #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "TextLog".into() - } -} diff --git a/crates/store/re_types/src/blueprint/views/time_series_view.rs b/crates/store/re_types/src/blueprint/views/time_series_view.rs index f6c9bf60b15fe..f00921b29805d 100644 --- a/crates/store/re_types/src/blueprint/views/time_series_view.rs +++ b/crates/store/re_types/src/blueprint/views/time_series_view.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **View**: A time series view for scalars over time, for use with [`archetypes::Scalar`][crate::archetypes::Scalar]. @@ -34,6 +34,13 @@ pub struct TimeSeriesView { pub time_ranges: crate::blueprint::archetypes::VisibleTimeRanges, } +impl ::re_types_core::View for TimeSeriesView { + #[inline] + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "TimeSeries".into() + } +} + impl ::re_types_core::SizeBytes for TimeSeriesView { #[inline] fn heap_size_bytes(&self) -> u64 { @@ -49,10 +56,3 @@ impl ::re_types_core::SizeBytes for TimeSeriesView { && ::is_pod() } } - -impl ::re_types_core::View for TimeSeriesView { - #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "TimeSeries".into() - } -} diff --git a/crates/store/re_types/src/components/aggregation_policy.rs b/crates/store/re_types/src/components/aggregation_policy.rs index 17a4f8fc6b96d..f5aed613daad0 100644 --- a/crates/store/re_types/src/components/aggregation_policy.rs +++ b/crates/store/re_types/src/components/aggregation_policy.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Policy for aggregation of multiple scalar plot values. @@ -49,58 +49,10 @@ pub enum AggregationPolicy { MinMaxAverage = 6, } -impl ::re_types_core::reflection::Enum for AggregationPolicy { - #[inline] - fn variants() -> &'static [Self] { - &[ - Self::Off, - Self::Average, - Self::Max, - Self::Min, - Self::MinMax, - Self::MinMaxAverage, - ] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Off => "No aggregation.", - Self::Average => "Average all points in the range together.", - Self::Max => "Keep only the maximum values in the range.", - Self::Min => "Keep only the minimum values in the range.", - Self::MinMax => { - "Keep both the minimum and maximum values in the range.\n\nThis will yield two aggregated points instead of one, effectively creating a vertical line." - } - Self::MinMaxAverage => { - "Find both the minimum and maximum values in the range, then use the average of those." - } - } - } -} - -impl ::re_types_core::SizeBytes for AggregationPolicy { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for AggregationPolicy { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for AggregationPolicy { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Off => write!(f, "Off"), - Self::Average => write!(f, "Average"), - Self::Max => write!(f, "Max"), - Self::Min => write!(f, "Min"), - Self::MinMax => write!(f, "MinMax"), - Self::MinMaxAverage => write!(f, "MinMaxAverage"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.AggregationPolicy") } } @@ -194,9 +146,57 @@ impl ::re_types_core::Loggable for AggregationPolicy { } } -impl ::re_types_core::Component for AggregationPolicy { +impl std::fmt::Display for AggregationPolicy { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Off => write!(f, "Off"), + Self::Average => write!(f, "Average"), + Self::Max => write!(f, "Max"), + Self::Min => write!(f, "Min"), + Self::MinMax => write!(f, "MinMax"), + Self::MinMaxAverage => write!(f, "MinMaxAverage"), + } + } +} + +impl ::re_types_core::reflection::Enum for AggregationPolicy { + #[inline] + fn variants() -> &'static [Self] { + &[ + Self::Off, + Self::Average, + Self::Max, + Self::Min, + Self::MinMax, + Self::MinMaxAverage, + ] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::Off => "No aggregation.", + Self::Average => "Average all points in the range together.", + Self::Max => "Keep only the maximum values in the range.", + Self::Min => "Keep only the minimum values in the range.", + Self::MinMax => { + "Keep both the minimum and maximum values in the range.\n\nThis will yield two aggregated points instead of one, effectively creating a vertical line." + } + Self::MinMaxAverage => { + "Find both the minimum and maximum values in the range, then use the average of those." + } + } + } +} + +impl ::re_types_core::SizeBytes for AggregationPolicy { #[inline] - fn name() -> ComponentName { - "rerun.components.AggregationPolicy".into() + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/components/albedo_factor.rs b/crates/store/re_types/src/components/albedo_factor.rs index a11f0a6d9ee63..30d86e4a6f41e 100644 --- a/crates/store/re_types/src/components/albedo_factor.rs +++ b/crates/store/re_types/src/components/albedo_factor.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A color multiplier, usually applied to a whole entity, e.g. a mesh. @@ -25,44 +25,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct AlbedoFactor(pub crate::datatypes::Rgba32); -impl ::re_types_core::SizeBytes for AlbedoFactor { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for AlbedoFactor { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for AlbedoFactor { - #[inline] - fn borrow(&self) -> &crate::datatypes::Rgba32 { - &self.0 - } -} - -impl std::ops::Deref for AlbedoFactor { - type Target = crate::datatypes::Rgba32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Rgba32 { - &self.0 - } -} - -impl std::ops::DerefMut for AlbedoFactor { +impl ::re_types_core::Component for AlbedoFactor { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Rgba32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.AlbedoFactor") } } @@ -107,9 +73,43 @@ impl ::re_types_core::Loggable for AlbedoFactor { } } -impl ::re_types_core::Component for AlbedoFactor { +impl> From for AlbedoFactor { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for AlbedoFactor { + #[inline] + fn borrow(&self) -> &crate::datatypes::Rgba32 { + &self.0 + } +} + +impl std::ops::Deref for AlbedoFactor { + type Target = crate::datatypes::Rgba32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Rgba32 { + &self.0 + } +} + +impl std::ops::DerefMut for AlbedoFactor { #[inline] - fn name() -> ComponentName { - "rerun.components.AlbedoFactor".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Rgba32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AlbedoFactor { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/annotation_context.rs b/crates/store/re_types/src/components/annotation_context.rs index 0d433c1ab4ace..4ee25e1417cb3 100644 --- a/crates/store/re_types/src/components/annotation_context.rs +++ b/crates/store/re_types/src/components/annotation_context.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The annotation context provides additional information on how to display entities. @@ -31,23 +31,10 @@ pub struct AnnotationContext( pub Vec, ); -impl ::re_types_core::SizeBytes for AnnotationContext { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - +impl ::re_types_core::Component for AnnotationContext { #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl, T: IntoIterator> From - for AnnotationContext -{ - fn from(v: T) -> Self { - Self(v.into_iter().map(|v| v.into()).collect()) + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.AnnotationContext") } } @@ -189,9 +176,22 @@ impl ::re_types_core::Loggable for AnnotationContext { } } -impl ::re_types_core::Component for AnnotationContext { +impl, T: IntoIterator> From + for AnnotationContext +{ + fn from(v: T) -> Self { + Self(v.into_iter().map(|v| v.into()).collect()) + } +} + +impl ::re_types_core::SizeBytes for AnnotationContext { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + #[inline] - fn name() -> ComponentName { - "rerun.components.AnnotationContext".into() + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/components/axis_length.rs b/crates/store/re_types/src/components/axis_length.rs index 0d81cb23a7d1b..f63f869d247b6 100644 --- a/crates/store/re_types/src/components/axis_length.rs +++ b/crates/store/re_types/src/components/axis_length.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The length of an axis in local units of the space. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct AxisLength(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for AxisLength { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for AxisLength { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for AxisLength { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for AxisLength { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for AxisLength { +impl ::re_types_core::Component for AxisLength { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.AxisLength") } } @@ -106,9 +72,43 @@ impl ::re_types_core::Loggable for AxisLength { } } -impl ::re_types_core::Component for AxisLength { +impl> From for AxisLength { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for AxisLength { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for AxisLength { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for AxisLength { #[inline] - fn name() -> ComponentName { - "rerun.components.AxisLength".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AxisLength { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/blob.rs b/crates/store/re_types/src/components/blob.rs index 78dd2967aa50e..3a798a223136d 100644 --- a/crates/store/re_types/src/components/blob.rs +++ b/crates/store/re_types/src/components/blob.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A binary blob of data. @@ -25,15 +25,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Blob(pub crate::datatypes::Blob); -impl ::re_types_core::SizeBytes for Blob { +impl ::re_types_core::Component for Blob { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Blob") } +} +::re_types_core::macros::impl_into_cow!(Blob); + +impl ::re_types_core::Loggable for Blob { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Blob::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Blob::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Blob::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -66,42 +94,14 @@ impl std::ops::DerefMut for Blob { } } -::re_types_core::macros::impl_into_cow!(Blob); - -impl ::re_types_core::Loggable for Blob { +impl ::re_types_core::SizeBytes for Blob { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Blob::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Blob::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Blob::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for Blob { #[inline] - fn name() -> ComponentName { - "rerun.components.Blob".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/class_id.rs b/crates/store/re_types/src/components/class_id.rs index 7df2edaa92268..8d5bce9730add 100644 --- a/crates/store/re_types/src/components/class_id.rs +++ b/crates/store/re_types/src/components/class_id.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 16-bit ID representing a type of semantic class. @@ -28,44 +28,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct ClassId(pub crate::datatypes::ClassId); -impl ::re_types_core::SizeBytes for ClassId { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for ClassId { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for ClassId { - #[inline] - fn borrow(&self) -> &crate::datatypes::ClassId { - &self.0 - } -} - -impl std::ops::Deref for ClassId { - type Target = crate::datatypes::ClassId; - - #[inline] - fn deref(&self) -> &crate::datatypes::ClassId { - &self.0 - } -} - -impl std::ops::DerefMut for ClassId { +impl ::re_types_core::Component for ClassId { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::ClassId { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.ClassId") } } @@ -110,9 +76,43 @@ impl ::re_types_core::Loggable for ClassId { } } -impl ::re_types_core::Component for ClassId { +impl> From for ClassId { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ClassId { + #[inline] + fn borrow(&self) -> &crate::datatypes::ClassId { + &self.0 + } +} + +impl std::ops::Deref for ClassId { + type Target = crate::datatypes::ClassId; + + #[inline] + fn deref(&self) -> &crate::datatypes::ClassId { + &self.0 + } +} + +impl std::ops::DerefMut for ClassId { #[inline] - fn name() -> ComponentName { - "rerun.components.ClassId".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::ClassId { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ClassId { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/color.rs b/crates/store/re_types/src/components/color.rs index 731c1ba07f046..0a4f4c97ccd11 100644 --- a/crates/store/re_types/src/components/color.rs +++ b/crates/store/re_types/src/components/color.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. @@ -26,44 +26,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Color(pub crate::datatypes::Rgba32); -impl ::re_types_core::SizeBytes for Color { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Color { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Color { - #[inline] - fn borrow(&self) -> &crate::datatypes::Rgba32 { - &self.0 - } -} - -impl std::ops::Deref for Color { - type Target = crate::datatypes::Rgba32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Rgba32 { - &self.0 - } -} - -impl std::ops::DerefMut for Color { +impl ::re_types_core::Component for Color { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Rgba32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Color") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for Color { } } -impl ::re_types_core::Component for Color { +impl> From for Color { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Color { + #[inline] + fn borrow(&self) -> &crate::datatypes::Rgba32 { + &self.0 + } +} + +impl std::ops::Deref for Color { + type Target = crate::datatypes::Rgba32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Rgba32 { + &self.0 + } +} + +impl std::ops::DerefMut for Color { #[inline] - fn name() -> ComponentName { - "rerun.components.Color".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Rgba32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Color { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/colormap.rs b/crates/store/re_types/src/components/colormap.rs index 0ae6dd35456b2..52fdd75237414 100644 --- a/crates/store/re_types/src/components/colormap.rs +++ b/crates/store/re_types/src/components/colormap.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Colormap for mapping scalar values within a given range to a color. @@ -73,71 +73,10 @@ pub enum Colormap { CyanToYellow = 7, } -impl ::re_types_core::reflection::Enum for Colormap { - #[inline] - fn variants() -> &'static [Self] { - &[ - Self::Grayscale, - Self::Inferno, - Self::Magma, - Self::Plasma, - Self::Turbo, - Self::Viridis, - Self::CyanToYellow, - ] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Grayscale => { - "A simple black to white gradient.\n\nThis is a sRGB gray gradient which is perceptually uniform." - } - Self::Inferno => { - "The Inferno colormap from Matplotlib.\n\nThis is a perceptually uniform colormap.\nIt interpolates from black to red to bright yellow." - } - Self::Magma => { - "The Magma colormap from Matplotlib.\n\nThis is a perceptually uniform colormap.\nIt interpolates from black to purple to white." - } - Self::Plasma => { - "The Plasma colormap from Matplotlib.\n\nThis is a perceptually uniform colormap.\nIt interpolates from dark blue to purple to yellow." - } - Self::Turbo => { - "Google's Turbo colormap map.\n\nThis is a perceptually non-uniform rainbow colormap addressing many issues of\nmore traditional rainbow colormaps like Jet.\nIt is more perceptually uniform without sharp transitions and is more colorblind-friendly.\nDetails: " - } - Self::Viridis => { - "The Viridis colormap from Matplotlib\n\nThis is a perceptually uniform colormap which is robust to color blindness.\nIt interpolates from dark purple to green to yellow." - } - Self::CyanToYellow => { - "Rasmusgo's Cyan to Yellow colormap\n\nThis is a perceptually uniform colormap which is robust to color blindness.\nIt is especially suited for visualizing signed values.\nIt interpolates from cyan to blue to dark gray to brass to yellow." - } - } - } -} - -impl ::re_types_core::SizeBytes for Colormap { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for Colormap { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for Colormap { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Grayscale => write!(f, "Grayscale"), - Self::Inferno => write!(f, "Inferno"), - Self::Magma => write!(f, "Magma"), - Self::Plasma => write!(f, "Plasma"), - Self::Turbo => write!(f, "Turbo"), - Self::Viridis => write!(f, "Viridis"), - Self::CyanToYellow => write!(f, "CyanToYellow"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Colormap") } } @@ -232,9 +171,70 @@ impl ::re_types_core::Loggable for Colormap { } } -impl ::re_types_core::Component for Colormap { +impl std::fmt::Display for Colormap { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Grayscale => write!(f, "Grayscale"), + Self::Inferno => write!(f, "Inferno"), + Self::Magma => write!(f, "Magma"), + Self::Plasma => write!(f, "Plasma"), + Self::Turbo => write!(f, "Turbo"), + Self::Viridis => write!(f, "Viridis"), + Self::CyanToYellow => write!(f, "CyanToYellow"), + } + } +} + +impl ::re_types_core::reflection::Enum for Colormap { #[inline] - fn name() -> ComponentName { - "rerun.components.Colormap".into() + fn variants() -> &'static [Self] { + &[ + Self::Grayscale, + Self::Inferno, + Self::Magma, + Self::Plasma, + Self::Turbo, + Self::Viridis, + Self::CyanToYellow, + ] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::Grayscale => { + "A simple black to white gradient.\n\nThis is a sRGB gray gradient which is perceptually uniform." + } + Self::Inferno => { + "The Inferno colormap from Matplotlib.\n\nThis is a perceptually uniform colormap.\nIt interpolates from black to red to bright yellow." + } + Self::Magma => { + "The Magma colormap from Matplotlib.\n\nThis is a perceptually uniform colormap.\nIt interpolates from black to purple to white." + } + Self::Plasma => { + "The Plasma colormap from Matplotlib.\n\nThis is a perceptually uniform colormap.\nIt interpolates from dark blue to purple to yellow." + } + Self::Turbo => { + "Google's Turbo colormap map.\n\nThis is a perceptually non-uniform rainbow colormap addressing many issues of\nmore traditional rainbow colormaps like Jet.\nIt is more perceptually uniform without sharp transitions and is more colorblind-friendly.\nDetails: " + } + Self::Viridis => { + "The Viridis colormap from Matplotlib\n\nThis is a perceptually uniform colormap which is robust to color blindness.\nIt interpolates from dark purple to green to yellow." + } + Self::CyanToYellow => { + "Rasmusgo's Cyan to Yellow colormap\n\nThis is a perceptually uniform colormap which is robust to color blindness.\nIt is especially suited for visualizing signed values.\nIt interpolates from cyan to blue to dark gray to brass to yellow." + } + } + } +} + +impl ::re_types_core::SizeBytes for Colormap { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/components/depth_meter.rs b/crates/store/re_types/src/components/depth_meter.rs index 6f9c37f3a0462..dddf77900aa5d 100644 --- a/crates/store/re_types/src/components/depth_meter.rs +++ b/crates/store/re_types/src/components/depth_meter.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The world->depth map scaling factor. @@ -30,44 +30,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct DepthMeter(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for DepthMeter { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for DepthMeter { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for DepthMeter { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for DepthMeter { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for DepthMeter { +impl ::re_types_core::Component for DepthMeter { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.DepthMeter") } } @@ -112,9 +78,43 @@ impl ::re_types_core::Loggable for DepthMeter { } } -impl ::re_types_core::Component for DepthMeter { +impl> From for DepthMeter { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for DepthMeter { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for DepthMeter { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for DepthMeter { #[inline] - fn name() -> ComponentName { - "rerun.components.DepthMeter".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for DepthMeter { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/disconnected_space.rs b/crates/store/re_types/src/components/disconnected_space.rs index ed96d1dd74065..45507885ccc7b 100644 --- a/crates/store/re_types/src/components/disconnected_space.rs +++ b/crates/store/re_types/src/components/disconnected_space.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Spatially disconnect this entity from its parent. @@ -34,15 +34,43 @@ pub struct DisconnectedSpace( pub crate::datatypes::Bool, ); -impl ::re_types_core::SizeBytes for DisconnectedSpace { +impl ::re_types_core::Component for DisconnectedSpace { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.DisconnectedSpace") } +} +::re_types_core::macros::impl_into_cow!(DisconnectedSpace); + +impl ::re_types_core::Loggable for DisconnectedSpace { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -75,42 +103,14 @@ impl std::ops::DerefMut for DisconnectedSpace { } } -::re_types_core::macros::impl_into_cow!(DisconnectedSpace); - -impl ::re_types_core::Loggable for DisconnectedSpace { +impl ::re_types_core::SizeBytes for DisconnectedSpace { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for DisconnectedSpace { #[inline] - fn name() -> ComponentName { - "rerun.components.DisconnectedSpace".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/draw_order.rs b/crates/store/re_types/src/components/draw_order.rs index a3ae26ecbc254..b87fe649ad2c2 100644 --- a/crates/store/re_types/src/components/draw_order.rs +++ b/crates/store/re_types/src/components/draw_order.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Draw order of 2D elements. Higher values are drawn on top of lower values. @@ -28,44 +28,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct DrawOrder(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for DrawOrder { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for DrawOrder { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for DrawOrder { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for DrawOrder { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for DrawOrder { +impl ::re_types_core::Component for DrawOrder { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.DrawOrder") } } @@ -111,9 +77,43 @@ impl ::re_types_core::Loggable for DrawOrder { } } -impl ::re_types_core::Component for DrawOrder { +impl> From for DrawOrder { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for DrawOrder { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for DrawOrder { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for DrawOrder { #[inline] - fn name() -> ComponentName { - "rerun.components.DrawOrder".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for DrawOrder { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/entity_path.rs b/crates/store/re_types/src/components/entity_path.rs index b9b6c23c4ada8..4c15512616472 100644 --- a/crates/store/re_types/src/components/entity_path.rs +++ b/crates/store/re_types/src/components/entity_path.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A path to an entity, usually to reference some data that is part of the target entity. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct EntityPath(pub crate::datatypes::EntityPath); -impl ::re_types_core::SizeBytes for EntityPath { +impl ::re_types_core::Component for EntityPath { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.EntityPath") } +} +::re_types_core::macros::impl_into_cow!(EntityPath); + +impl ::re_types_core::Loggable for EntityPath { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::EntityPath::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::EntityPath::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::EntityPath::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for EntityPath { } } -::re_types_core::macros::impl_into_cow!(EntityPath); - -impl ::re_types_core::Loggable for EntityPath { +impl ::re_types_core::SizeBytes for EntityPath { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::EntityPath::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::EntityPath::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::EntityPath::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for EntityPath { #[inline] - fn name() -> ComponentName { - "rerun.components.EntityPath".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/fill_mode.rs b/crates/store/re_types/src/components/fill_mode.rs index f96e05e7ceb35..1a6b262f0bdda 100644 --- a/crates/store/re_types/src/components/fill_mode.rs +++ b/crates/store/re_types/src/components/fill_mode.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: How a geometric shape is drawn and colored. @@ -46,47 +46,10 @@ pub enum FillMode { Solid = 3, } -impl ::re_types_core::reflection::Enum for FillMode { - #[inline] - fn variants() -> &'static [Self] { - &[Self::MajorWireframe, Self::DenseWireframe, Self::Solid] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::MajorWireframe => { - "Lines are drawn around the parts of the shape which directly correspond to the logged data.\n\nExamples of what this means:\n\n* An [`archetypes::Ellipsoids3D`][crate::archetypes::Ellipsoids3D] will draw three axis-aligned ellipses that are cross-sections\n of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid.\n* For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to `DenseWireframe`." - } - Self::DenseWireframe => { - "Many lines are drawn to represent the surface of the shape in a see-through fashion.\n\nExamples of what this means:\n\n* An [`archetypes::Ellipsoids3D`][crate::archetypes::Ellipsoids3D] will draw a wireframe triangle mesh that approximates each\n ellipsoid.\n* For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to `MajorWireframe`." - } - Self::Solid => { - "The surface of the shape is filled in with a solid color. No lines are drawn." - } - } - } -} - -impl ::re_types_core::SizeBytes for FillMode { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for FillMode { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for FillMode { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::MajorWireframe => write!(f, "MajorWireframe"), - Self::DenseWireframe => write!(f, "DenseWireframe"), - Self::Solid => write!(f, "Solid"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.FillMode") } } @@ -177,9 +140,46 @@ impl ::re_types_core::Loggable for FillMode { } } -impl ::re_types_core::Component for FillMode { +impl std::fmt::Display for FillMode { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::MajorWireframe => write!(f, "MajorWireframe"), + Self::DenseWireframe => write!(f, "DenseWireframe"), + Self::Solid => write!(f, "Solid"), + } + } +} + +impl ::re_types_core::reflection::Enum for FillMode { + #[inline] + fn variants() -> &'static [Self] { + &[Self::MajorWireframe, Self::DenseWireframe, Self::Solid] + } + #[inline] - fn name() -> ComponentName { - "rerun.components.FillMode".into() + fn docstring_md(self) -> &'static str { + match self { + Self::MajorWireframe => { + "Lines are drawn around the parts of the shape which directly correspond to the logged data.\n\nExamples of what this means:\n\n* An [`archetypes::Ellipsoids3D`][crate::archetypes::Ellipsoids3D] will draw three axis-aligned ellipses that are cross-sections\n of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid.\n* For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to `DenseWireframe`." + } + Self::DenseWireframe => { + "Many lines are drawn to represent the surface of the shape in a see-through fashion.\n\nExamples of what this means:\n\n* An [`archetypes::Ellipsoids3D`][crate::archetypes::Ellipsoids3D] will draw a wireframe triangle mesh that approximates each\n ellipsoid.\n* For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to `MajorWireframe`." + } + Self::Solid => { + "The surface of the shape is filled in with a solid color. No lines are drawn." + } + } + } +} + +impl ::re_types_core::SizeBytes for FillMode { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/components/fill_ratio.rs b/crates/store/re_types/src/components/fill_ratio.rs index 53f23b6af66c6..9f9706f240f99 100644 --- a/crates/store/re_types/src/components/fill_ratio.rs +++ b/crates/store/re_types/src/components/fill_ratio.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: How much a primitive fills out the available space. @@ -28,44 +28,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct FillRatio(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for FillRatio { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for FillRatio { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for FillRatio { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for FillRatio { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for FillRatio { +impl ::re_types_core::Component for FillRatio { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.FillRatio") } } @@ -110,9 +76,43 @@ impl ::re_types_core::Loggable for FillRatio { } } -impl ::re_types_core::Component for FillRatio { +impl> From for FillRatio { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for FillRatio { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for FillRatio { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for FillRatio { #[inline] - fn name() -> ComponentName { - "rerun.components.FillRatio".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for FillRatio { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/gamma_correction.rs b/crates/store/re_types/src/components/gamma_correction.rs index 456903d5b6e49..85844225c48a7 100644 --- a/crates/store/re_types/src/components/gamma_correction.rs +++ b/crates/store/re_types/src/components/gamma_correction.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A gamma correction value to be used with a scalar value or color. @@ -29,44 +29,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct GammaCorrection(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for GammaCorrection { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for GammaCorrection { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for GammaCorrection { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for GammaCorrection { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for GammaCorrection { +impl ::re_types_core::Component for GammaCorrection { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.GammaCorrection") } } @@ -111,9 +77,43 @@ impl ::re_types_core::Loggable for GammaCorrection { } } -impl ::re_types_core::Component for GammaCorrection { +impl> From for GammaCorrection { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for GammaCorrection { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for GammaCorrection { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for GammaCorrection { #[inline] - fn name() -> ComponentName { - "rerun.components.GammaCorrection".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for GammaCorrection { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/geo_line_string.rs b/crates/store/re_types/src/components/geo_line_string.rs index 48580a0b01d4f..ff2aa3021a112 100644 --- a/crates/store/re_types/src/components/geo_line_string.rs +++ b/crates/store/re_types/src/components/geo_line_string.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A geospatial line string expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees). @@ -23,21 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct GeoLineString(pub Vec); -impl ::re_types_core::SizeBytes for GeoLineString { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - +impl ::re_types_core::Component for GeoLineString { #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl, T: IntoIterator> From for GeoLineString { - fn from(v: T) -> Self { - Self(v.into_iter().map(|v| v.into()).collect()) + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.GeoLineString") } } @@ -261,9 +250,20 @@ impl ::re_types_core::Loggable for GeoLineString { } } -impl ::re_types_core::Component for GeoLineString { +impl, T: IntoIterator> From for GeoLineString { + fn from(v: T) -> Self { + Self(v.into_iter().map(|v| v.into()).collect()) + } +} + +impl ::re_types_core::SizeBytes for GeoLineString { #[inline] - fn name() -> ComponentName { - "rerun.components.GeoLineString".into() + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/components/graph_edge.rs b/crates/store/re_types/src/components/graph_edge.rs index e85b7c37a5ddc..b6527ab6413ed 100644 --- a/crates/store/re_types/src/components/graph_edge.rs +++ b/crates/store/re_types/src/components/graph_edge.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: An edge in a graph connecting two nodes. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct GraphEdge(pub crate::datatypes::Utf8Pair); -impl ::re_types_core::SizeBytes for GraphEdge { +impl ::re_types_core::Component for GraphEdge { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.GraphEdge") } +} +::re_types_core::macros::impl_into_cow!(GraphEdge); + +impl ::re_types_core::Loggable for GraphEdge { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8Pair::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8Pair::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8Pair::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for GraphEdge { } } -::re_types_core::macros::impl_into_cow!(GraphEdge); - -impl ::re_types_core::Loggable for GraphEdge { +impl ::re_types_core::SizeBytes for GraphEdge { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8Pair::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8Pair::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8Pair::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for GraphEdge { #[inline] - fn name() -> ComponentName { - "rerun.components.GraphEdge".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/graph_node.rs b/crates/store/re_types/src/components/graph_node.rs index daa820248817d..63c7ebc0e7499 100644 --- a/crates/store/re_types/src/components/graph_node.rs +++ b/crates/store/re_types/src/components/graph_node.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A string-based ID representing a node in a graph. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct GraphNode(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for GraphNode { +impl ::re_types_core::Component for GraphNode { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.GraphNode") } +} +::re_types_core::macros::impl_into_cow!(GraphNode); + +impl ::re_types_core::Loggable for GraphNode { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for GraphNode { } } -::re_types_core::macros::impl_into_cow!(GraphNode); - -impl ::re_types_core::Loggable for GraphNode { +impl ::re_types_core::SizeBytes for GraphNode { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for GraphNode { #[inline] - fn name() -> ComponentName { - "rerun.components.GraphNode".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/graph_type.rs b/crates/store/re_types/src/components/graph_type.rs index 87979d9974571..34029444a6d32 100644 --- a/crates/store/re_types/src/components/graph_type.rs +++ b/crates/store/re_types/src/components/graph_type.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Specifies if a graph has directed or undirected edges. @@ -31,39 +31,10 @@ pub enum GraphType { Directed = 2, } -impl ::re_types_core::reflection::Enum for GraphType { - #[inline] - fn variants() -> &'static [Self] { - &[Self::Undirected, Self::Directed] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Undirected => "The graph has undirected edges.", - Self::Directed => "The graph has directed edges.", - } - } -} - -impl ::re_types_core::SizeBytes for GraphType { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for GraphType { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for GraphType { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Undirected => write!(f, "Undirected"), - Self::Directed => write!(f, "Directed"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.GraphType") } } @@ -153,9 +124,38 @@ impl ::re_types_core::Loggable for GraphType { } } -impl ::re_types_core::Component for GraphType { +impl std::fmt::Display for GraphType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Undirected => write!(f, "Undirected"), + Self::Directed => write!(f, "Directed"), + } + } +} + +impl ::re_types_core::reflection::Enum for GraphType { + #[inline] + fn variants() -> &'static [Self] { + &[Self::Undirected, Self::Directed] + } + #[inline] - fn name() -> ComponentName { - "rerun.components.GraphType".into() + fn docstring_md(self) -> &'static str { + match self { + Self::Undirected => "The graph has undirected edges.", + Self::Directed => "The graph has directed edges.", + } + } +} + +impl ::re_types_core::SizeBytes for GraphType { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/components/half_size2d.rs b/crates/store/re_types/src/components/half_size2d.rs index d6bf57e237944..c67e9c1a4f183 100644 --- a/crates/store/re_types/src/components/half_size2d.rs +++ b/crates/store/re_types/src/components/half_size2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Half-size (radius) of a 2D box. @@ -28,44 +28,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct HalfSize2D(pub crate::datatypes::Vec2D); -impl ::re_types_core::SizeBytes for HalfSize2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for HalfSize2D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for HalfSize2D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::Deref for HalfSize2D { - type Target = crate::datatypes::Vec2D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::DerefMut for HalfSize2D { +impl ::re_types_core::Component for HalfSize2D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.HalfSize2D") } } @@ -110,9 +76,43 @@ impl ::re_types_core::Loggable for HalfSize2D { } } -impl ::re_types_core::Component for HalfSize2D { +impl> From for HalfSize2D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for HalfSize2D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::Deref for HalfSize2D { + type Target = crate::datatypes::Vec2D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::DerefMut for HalfSize2D { #[inline] - fn name() -> ComponentName { - "rerun.components.HalfSize2D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for HalfSize2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/half_size3d.rs b/crates/store/re_types/src/components/half_size3d.rs index d4ba442685314..2e95bde614e36 100644 --- a/crates/store/re_types/src/components/half_size3d.rs +++ b/crates/store/re_types/src/components/half_size3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Half-size (radius) of a 3D box. @@ -28,44 +28,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct HalfSize3D(pub crate::datatypes::Vec3D); -impl ::re_types_core::SizeBytes for HalfSize3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for HalfSize3D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for HalfSize3D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::Deref for HalfSize3D { - type Target = crate::datatypes::Vec3D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::DerefMut for HalfSize3D { +impl ::re_types_core::Component for HalfSize3D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.HalfSize3D") } } @@ -110,9 +76,43 @@ impl ::re_types_core::Loggable for HalfSize3D { } } -impl ::re_types_core::Component for HalfSize3D { +impl> From for HalfSize3D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for HalfSize3D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::Deref for HalfSize3D { + type Target = crate::datatypes::Vec3D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::DerefMut for HalfSize3D { #[inline] - fn name() -> ComponentName { - "rerun.components.HalfSize3D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for HalfSize3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/image_buffer.rs b/crates/store/re_types/src/components/image_buffer.rs index 79bafe36e5e3f..54c5abbb9fd4f 100644 --- a/crates/store/re_types/src/components/image_buffer.rs +++ b/crates/store/re_types/src/components/image_buffer.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A buffer that is known to store image data. @@ -25,15 +25,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct ImageBuffer(pub crate::datatypes::Blob); -impl ::re_types_core::SizeBytes for ImageBuffer { +impl ::re_types_core::Component for ImageBuffer { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.ImageBuffer") } +} +::re_types_core::macros::impl_into_cow!(ImageBuffer); + +impl ::re_types_core::Loggable for ImageBuffer { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Blob::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Blob::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Blob::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -66,42 +94,14 @@ impl std::ops::DerefMut for ImageBuffer { } } -::re_types_core::macros::impl_into_cow!(ImageBuffer); - -impl ::re_types_core::Loggable for ImageBuffer { +impl ::re_types_core::SizeBytes for ImageBuffer { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Blob::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Blob::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Blob::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for ImageBuffer { #[inline] - fn name() -> ComponentName { - "rerun.components.ImageBuffer".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/image_format.rs b/crates/store/re_types/src/components/image_format.rs index 74afc7ba4df47..2f68c2f0051b9 100644 --- a/crates/store/re_types/src/components/image_format.rs +++ b/crates/store/re_types/src/components/image_format.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The metadata describing the contents of a [`components::ImageBuffer`][crate::components::ImageBuffer]. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct ImageFormat(pub crate::datatypes::ImageFormat); -impl ::re_types_core::SizeBytes for ImageFormat { +impl ::re_types_core::Component for ImageFormat { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.ImageFormat") } +} +::re_types_core::macros::impl_into_cow!(ImageFormat); + +impl ::re_types_core::Loggable for ImageFormat { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::ImageFormat::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::ImageFormat::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::ImageFormat::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for ImageFormat { } } -::re_types_core::macros::impl_into_cow!(ImageFormat); - -impl ::re_types_core::Loggable for ImageFormat { +impl ::re_types_core::SizeBytes for ImageFormat { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::ImageFormat::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::ImageFormat::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::ImageFormat::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for ImageFormat { #[inline] - fn name() -> ComponentName { - "rerun.components.ImageFormat".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/image_plane_distance.rs b/crates/store/re_types/src/components/image_plane_distance.rs index 45935f9f1c45f..63366c3c24017 100644 --- a/crates/store/re_types/src/components/image_plane_distance.rs +++ b/crates/store/re_types/src/components/image_plane_distance.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The distance from the camera origin to the image plane when the projection is shown in a 3D viewer. @@ -24,44 +24,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Copy, PartialEq, PartialOrd)] pub struct ImagePlaneDistance(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for ImagePlaneDistance { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for ImagePlaneDistance { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for ImagePlaneDistance { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for ImagePlaneDistance { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for ImagePlaneDistance { +impl ::re_types_core::Component for ImagePlaneDistance { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.ImagePlaneDistance") } } @@ -107,9 +73,43 @@ impl ::re_types_core::Loggable for ImagePlaneDistance { } } -impl ::re_types_core::Component for ImagePlaneDistance { +impl> From for ImagePlaneDistance { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ImagePlaneDistance { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for ImagePlaneDistance { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for ImagePlaneDistance { #[inline] - fn name() -> ComponentName { - "rerun.components.ImagePlaneDistance".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ImagePlaneDistance { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/keypoint_id.rs b/crates/store/re_types/src/components/keypoint_id.rs index ecc81d62c883c..43845b5791e37 100644 --- a/crates/store/re_types/src/components/keypoint_id.rs +++ b/crates/store/re_types/src/components/keypoint_id.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 16-bit ID representing a type of semantic keypoint within a class. @@ -40,44 +40,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct KeypointId(pub crate::datatypes::KeypointId); -impl ::re_types_core::SizeBytes for KeypointId { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for KeypointId { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for KeypointId { - #[inline] - fn borrow(&self) -> &crate::datatypes::KeypointId { - &self.0 - } -} - -impl std::ops::Deref for KeypointId { - type Target = crate::datatypes::KeypointId; - - #[inline] - fn deref(&self) -> &crate::datatypes::KeypointId { - &self.0 - } -} - -impl std::ops::DerefMut for KeypointId { +impl ::re_types_core::Component for KeypointId { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::KeypointId { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.KeypointId") } } @@ -122,9 +88,43 @@ impl ::re_types_core::Loggable for KeypointId { } } -impl ::re_types_core::Component for KeypointId { +impl> From for KeypointId { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for KeypointId { + #[inline] + fn borrow(&self) -> &crate::datatypes::KeypointId { + &self.0 + } +} + +impl std::ops::Deref for KeypointId { + type Target = crate::datatypes::KeypointId; + + #[inline] + fn deref(&self) -> &crate::datatypes::KeypointId { + &self.0 + } +} + +impl std::ops::DerefMut for KeypointId { #[inline] - fn name() -> ComponentName { - "rerun.components.KeypointId".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::KeypointId { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for KeypointId { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/lat_lon.rs b/crates/store/re_types/src/components/lat_lon.rs index a6e64499ab026..b1be5e5f2022f 100644 --- a/crates/store/re_types/src/components/lat_lon.rs +++ b/crates/store/re_types/src/components/lat_lon.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A geospatial position expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees). @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct LatLon(pub crate::datatypes::DVec2D); -impl ::re_types_core::SizeBytes for LatLon { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for LatLon { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for LatLon { - #[inline] - fn borrow(&self) -> &crate::datatypes::DVec2D { - &self.0 - } -} - -impl std::ops::Deref for LatLon { - type Target = crate::datatypes::DVec2D; - - #[inline] - fn deref(&self) -> &crate::datatypes::DVec2D { - &self.0 - } -} - -impl std::ops::DerefMut for LatLon { +impl ::re_types_core::Component for LatLon { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::DVec2D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.LatLon") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for LatLon { } } -impl ::re_types_core::Component for LatLon { +impl> From for LatLon { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for LatLon { + #[inline] + fn borrow(&self) -> &crate::datatypes::DVec2D { + &self.0 + } +} + +impl std::ops::Deref for LatLon { + type Target = crate::datatypes::DVec2D; + + #[inline] + fn deref(&self) -> &crate::datatypes::DVec2D { + &self.0 + } +} + +impl std::ops::DerefMut for LatLon { #[inline] - fn name() -> ComponentName { - "rerun.components.LatLon".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::DVec2D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for LatLon { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/length.rs b/crates/store/re_types/src/components/length.rs index 26127dce80ae7..8dcdbbd8106d3 100644 --- a/crates/store/re_types/src/components/length.rs +++ b/crates/store/re_types/src/components/length.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Length, or one-dimensional size. @@ -26,44 +26,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Length(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for Length { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Length { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Length { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for Length { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for Length { +impl ::re_types_core::Component for Length { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Length") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for Length { } } -impl ::re_types_core::Component for Length { +impl> From for Length { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Length { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for Length { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for Length { #[inline] - fn name() -> ComponentName { - "rerun.components.Length".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Length { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/line_strip2d.rs b/crates/store/re_types/src/components/line_strip2d.rs index c4df3ea366d68..acf5d0415c8c0 100644 --- a/crates/store/re_types/src/components/line_strip2d.rs +++ b/crates/store/re_types/src/components/line_strip2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A line strip in 2D space. @@ -33,21 +33,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct LineStrip2D(pub Vec); -impl ::re_types_core::SizeBytes for LineStrip2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - +impl ::re_types_core::Component for LineStrip2D { #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl, T: IntoIterator> From for LineStrip2D { - fn from(v: T) -> Self { - Self(v.into_iter().map(|v| v.into()).collect()) + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.LineStrip2D") } } @@ -270,9 +259,20 @@ impl ::re_types_core::Loggable for LineStrip2D { } } -impl ::re_types_core::Component for LineStrip2D { +impl, T: IntoIterator> From for LineStrip2D { + fn from(v: T) -> Self { + Self(v.into_iter().map(|v| v.into()).collect()) + } +} + +impl ::re_types_core::SizeBytes for LineStrip2D { #[inline] - fn name() -> ComponentName { - "rerun.components.LineStrip2D".into() + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/components/line_strip3d.rs b/crates/store/re_types/src/components/line_strip3d.rs index 0bbbc236b2b82..341dd687472e5 100644 --- a/crates/store/re_types/src/components/line_strip3d.rs +++ b/crates/store/re_types/src/components/line_strip3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A line strip in 3D space. @@ -33,21 +33,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct LineStrip3D(pub Vec); -impl ::re_types_core::SizeBytes for LineStrip3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - +impl ::re_types_core::Component for LineStrip3D { #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl, T: IntoIterator> From for LineStrip3D { - fn from(v: T) -> Self { - Self(v.into_iter().map(|v| v.into()).collect()) + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.LineStrip3D") } } @@ -270,9 +259,20 @@ impl ::re_types_core::Loggable for LineStrip3D { } } -impl ::re_types_core::Component for LineStrip3D { +impl, T: IntoIterator> From for LineStrip3D { + fn from(v: T) -> Self { + Self(v.into_iter().map(|v| v.into()).collect()) + } +} + +impl ::re_types_core::SizeBytes for LineStrip3D { #[inline] - fn name() -> ComponentName { - "rerun.components.LineStrip3D".into() + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/components/magnification_filter.rs b/crates/store/re_types/src/components/magnification_filter.rs index 77faef9806124..db92e7b96a5e2 100644 --- a/crates/store/re_types/src/components/magnification_filter.rs +++ b/crates/store/re_types/src/components/magnification_filter.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Filter used when magnifying an image/texture such that a single pixel/texel is displayed as multiple pixels on screen. @@ -36,43 +36,10 @@ pub enum MagnificationFilter { Linear = 2, } -impl ::re_types_core::reflection::Enum for MagnificationFilter { - #[inline] - fn variants() -> &'static [Self] { - &[Self::Nearest, Self::Linear] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Nearest => { - "Show the nearest pixel value.\n\nThis will give a blocky appearance when zooming in.\nUsed as default when rendering 2D images." - } - Self::Linear => { - "Linearly interpolate the nearest neighbors, creating a smoother look when zooming in.\n\nUsed as default for mesh rendering." - } - } - } -} - -impl ::re_types_core::SizeBytes for MagnificationFilter { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for MagnificationFilter { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for MagnificationFilter { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Nearest => write!(f, "Nearest"), - Self::Linear => write!(f, "Linear"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.MagnificationFilter") } } @@ -162,9 +129,42 @@ impl ::re_types_core::Loggable for MagnificationFilter { } } -impl ::re_types_core::Component for MagnificationFilter { +impl std::fmt::Display for MagnificationFilter { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Nearest => write!(f, "Nearest"), + Self::Linear => write!(f, "Linear"), + } + } +} + +impl ::re_types_core::reflection::Enum for MagnificationFilter { #[inline] - fn name() -> ComponentName { - "rerun.components.MagnificationFilter".into() + fn variants() -> &'static [Self] { + &[Self::Nearest, Self::Linear] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::Nearest => { + "Show the nearest pixel value.\n\nThis will give a blocky appearance when zooming in.\nUsed as default when rendering 2D images." + } + Self::Linear => { + "Linearly interpolate the nearest neighbors, creating a smoother look when zooming in.\n\nUsed as default for mesh rendering." + } + } + } +} + +impl ::re_types_core::SizeBytes for MagnificationFilter { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/components/marker_shape.rs b/crates/store/re_types/src/components/marker_shape.rs index 20ef6f9610c9d..0736b65fa772e 100644 --- a/crates/store/re_types/src/components/marker_shape.rs +++ b/crates/store/re_types/src/components/marker_shape.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The visual appearance of a point in e.g. a 2D plot. @@ -55,66 +55,10 @@ pub enum MarkerShape { Asterisk = 10, } -impl ::re_types_core::reflection::Enum for MarkerShape { - #[inline] - fn variants() -> &'static [Self] { - &[ - Self::Circle, - Self::Diamond, - Self::Square, - Self::Cross, - Self::Plus, - Self::Up, - Self::Down, - Self::Left, - Self::Right, - Self::Asterisk, - ] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Circle => "`⏺`", - Self::Diamond => "`◆`", - Self::Square => "`◼\u{fe0f}`", - Self::Cross => "`x`", - Self::Plus => "`+`", - Self::Up => "`▲`", - Self::Down => "`▼`", - Self::Left => "`◀`", - Self::Right => "`▶`", - Self::Asterisk => "`*`", - } - } -} - -impl ::re_types_core::SizeBytes for MarkerShape { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for MarkerShape { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for MarkerShape { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Circle => write!(f, "Circle"), - Self::Diamond => write!(f, "Diamond"), - Self::Square => write!(f, "Square"), - Self::Cross => write!(f, "Cross"), - Self::Plus => write!(f, "Plus"), - Self::Up => write!(f, "Up"), - Self::Down => write!(f, "Down"), - Self::Left => write!(f, "Left"), - Self::Right => write!(f, "Right"), - Self::Asterisk => write!(f, "Asterisk"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.MarkerShape") } } @@ -212,9 +156,65 @@ impl ::re_types_core::Loggable for MarkerShape { } } -impl ::re_types_core::Component for MarkerShape { +impl std::fmt::Display for MarkerShape { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Circle => write!(f, "Circle"), + Self::Diamond => write!(f, "Diamond"), + Self::Square => write!(f, "Square"), + Self::Cross => write!(f, "Cross"), + Self::Plus => write!(f, "Plus"), + Self::Up => write!(f, "Up"), + Self::Down => write!(f, "Down"), + Self::Left => write!(f, "Left"), + Self::Right => write!(f, "Right"), + Self::Asterisk => write!(f, "Asterisk"), + } + } +} + +impl ::re_types_core::reflection::Enum for MarkerShape { + #[inline] + fn variants() -> &'static [Self] { + &[ + Self::Circle, + Self::Diamond, + Self::Square, + Self::Cross, + Self::Plus, + Self::Up, + Self::Down, + Self::Left, + Self::Right, + Self::Asterisk, + ] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::Circle => "`⏺`", + Self::Diamond => "`◆`", + Self::Square => "`◼\u{fe0f}`", + Self::Cross => "`x`", + Self::Plus => "`+`", + Self::Up => "`▲`", + Self::Down => "`▼`", + Self::Left => "`◀`", + Self::Right => "`▶`", + Self::Asterisk => "`*`", + } + } +} + +impl ::re_types_core::SizeBytes for MarkerShape { #[inline] - fn name() -> ComponentName { - "rerun.components.MarkerShape".into() + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/components/marker_size.rs b/crates/store/re_types/src/components/marker_size.rs index 206022bf21f57..0ff1b9c3e2415 100644 --- a/crates/store/re_types/src/components/marker_size.rs +++ b/crates/store/re_types/src/components/marker_size.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Radius of a marker of a point in e.g. a 2D plot, measured in UI points. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct MarkerSize(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for MarkerSize { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for MarkerSize { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for MarkerSize { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for MarkerSize { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for MarkerSize { +impl ::re_types_core::Component for MarkerSize { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.MarkerSize") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for MarkerSize { } } -impl ::re_types_core::Component for MarkerSize { +impl> From for MarkerSize { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for MarkerSize { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for MarkerSize { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for MarkerSize { #[inline] - fn name() -> ComponentName { - "rerun.components.MarkerSize".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for MarkerSize { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/media_type.rs b/crates/store/re_types/src/components/media_type.rs index 2eacec30e60ef..73c1560424ed3 100644 --- a/crates/store/re_types/src/components/media_type.rs +++ b/crates/store/re_types/src/components/media_type.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A standardized media type (RFC2046, formerly known as MIME types), encoded as a string. @@ -26,15 +26,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct MediaType(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for MediaType { +impl ::re_types_core::Component for MediaType { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.MediaType") } +} +::re_types_core::macros::impl_into_cow!(MediaType); + +impl ::re_types_core::Loggable for MediaType { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -67,42 +95,14 @@ impl std::ops::DerefMut for MediaType { } } -::re_types_core::macros::impl_into_cow!(MediaType); - -impl ::re_types_core::Loggable for MediaType { +impl ::re_types_core::SizeBytes for MediaType { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for MediaType { #[inline] - fn name() -> ComponentName { - "rerun.components.MediaType".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/name.rs b/crates/store/re_types/src/components/name.rs index 06f9fc3bea2ce..23c6bf3131a5f 100644 --- a/crates/store/re_types/src/components/name.rs +++ b/crates/store/re_types/src/components/name.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A display name, typically for an entity or a item like a plot series. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Name(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for Name { +impl ::re_types_core::Component for Name { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Name") } +} +::re_types_core::macros::impl_into_cow!(Name); + +impl ::re_types_core::Loggable for Name { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for Name { } } -::re_types_core::macros::impl_into_cow!(Name); - -impl ::re_types_core::Loggable for Name { +impl ::re_types_core::SizeBytes for Name { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for Name { #[inline] - fn name() -> ComponentName { - "rerun.components.Name".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/opacity.rs b/crates/store/re_types/src/components/opacity.rs index a8c7048b63b9c..2836c7d90f12a 100644 --- a/crates/store/re_types/src/components/opacity.rs +++ b/crates/store/re_types/src/components/opacity.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Degree of transparency ranging from 0.0 (fully transparent) to 1.0 (fully opaque). @@ -26,44 +26,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Opacity(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for Opacity { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Opacity { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Opacity { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for Opacity { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for Opacity { +impl ::re_types_core::Component for Opacity { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Opacity") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for Opacity { } } -impl ::re_types_core::Component for Opacity { +impl> From for Opacity { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Opacity { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for Opacity { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for Opacity { #[inline] - fn name() -> ComponentName { - "rerun.components.Opacity".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Opacity { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/pinhole_projection.rs b/crates/store/re_types/src/components/pinhole_projection.rs index 847249910dde7..d4a103d972244 100644 --- a/crates/store/re_types/src/components/pinhole_projection.rs +++ b/crates/store/re_types/src/components/pinhole_projection.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Camera projection, from image coordinates to view coordinates. @@ -32,44 +32,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Copy, PartialEq, PartialOrd)] pub struct PinholeProjection(pub crate::datatypes::Mat3x3); -impl ::re_types_core::SizeBytes for PinholeProjection { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for PinholeProjection { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for PinholeProjection { - #[inline] - fn borrow(&self) -> &crate::datatypes::Mat3x3 { - &self.0 - } -} - -impl std::ops::Deref for PinholeProjection { - type Target = crate::datatypes::Mat3x3; - - #[inline] - fn deref(&self) -> &crate::datatypes::Mat3x3 { - &self.0 - } -} - -impl std::ops::DerefMut for PinholeProjection { +impl ::re_types_core::Component for PinholeProjection { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Mat3x3 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.PinholeProjection") } } @@ -114,9 +80,43 @@ impl ::re_types_core::Loggable for PinholeProjection { } } -impl ::re_types_core::Component for PinholeProjection { +impl> From for PinholeProjection { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for PinholeProjection { + #[inline] + fn borrow(&self) -> &crate::datatypes::Mat3x3 { + &self.0 + } +} + +impl std::ops::Deref for PinholeProjection { + type Target = crate::datatypes::Mat3x3; + + #[inline] + fn deref(&self) -> &crate::datatypes::Mat3x3 { + &self.0 + } +} + +impl std::ops::DerefMut for PinholeProjection { #[inline] - fn name() -> ComponentName { - "rerun.components.PinholeProjection".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Mat3x3 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for PinholeProjection { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/pose_rotation_axis_angle.rs b/crates/store/re_types/src/components/pose_rotation_axis_angle.rs index c36f231806c9e..d95df9e01eae9 100644 --- a/crates/store/re_types/src/components/pose_rotation_axis_angle.rs +++ b/crates/store/re_types/src/components/pose_rotation_axis_angle.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: 3D rotation represented by a rotation around a given axis that doesn't propagate in the transform hierarchy. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct PoseRotationAxisAngle(pub crate::datatypes::RotationAxisAngle); -impl ::re_types_core::SizeBytes for PoseRotationAxisAngle { +impl ::re_types_core::Component for PoseRotationAxisAngle { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.PoseRotationAxisAngle") } +} +::re_types_core::macros::impl_into_cow!(PoseRotationAxisAngle); + +impl ::re_types_core::Loggable for PoseRotationAxisAngle { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::RotationAxisAngle::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::RotationAxisAngle::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::RotationAxisAngle::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for PoseRotationAxisAngle { } } -::re_types_core::macros::impl_into_cow!(PoseRotationAxisAngle); - -impl ::re_types_core::Loggable for PoseRotationAxisAngle { +impl ::re_types_core::SizeBytes for PoseRotationAxisAngle { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::RotationAxisAngle::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::RotationAxisAngle::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::RotationAxisAngle::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for PoseRotationAxisAngle { #[inline] - fn name() -> ComponentName { - "rerun.components.PoseRotationAxisAngle".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/pose_rotation_quat.rs b/crates/store/re_types/src/components/pose_rotation_quat.rs index fa2abc7d118dc..1af633569d3fb 100644 --- a/crates/store/re_types/src/components/pose_rotation_quat.rs +++ b/crates/store/re_types/src/components/pose_rotation_quat.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 3D rotation expressed as a quaternion that doesn't propagate in the transform hierarchy. @@ -26,44 +26,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct PoseRotationQuat(pub crate::datatypes::Quaternion); -impl ::re_types_core::SizeBytes for PoseRotationQuat { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for PoseRotationQuat { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for PoseRotationQuat { - #[inline] - fn borrow(&self) -> &crate::datatypes::Quaternion { - &self.0 - } -} - -impl std::ops::Deref for PoseRotationQuat { - type Target = crate::datatypes::Quaternion; - - #[inline] - fn deref(&self) -> &crate::datatypes::Quaternion { - &self.0 - } -} - -impl std::ops::DerefMut for PoseRotationQuat { +impl ::re_types_core::Component for PoseRotationQuat { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Quaternion { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.PoseRotationQuat") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for PoseRotationQuat { } } -impl ::re_types_core::Component for PoseRotationQuat { +impl> From for PoseRotationQuat { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for PoseRotationQuat { + #[inline] + fn borrow(&self) -> &crate::datatypes::Quaternion { + &self.0 + } +} + +impl std::ops::Deref for PoseRotationQuat { + type Target = crate::datatypes::Quaternion; + + #[inline] + fn deref(&self) -> &crate::datatypes::Quaternion { + &self.0 + } +} + +impl std::ops::DerefMut for PoseRotationQuat { #[inline] - fn name() -> ComponentName { - "rerun.components.PoseRotationQuat".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Quaternion { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for PoseRotationQuat { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/pose_scale3d.rs b/crates/store/re_types/src/components/pose_scale3d.rs index ec58d7e8c816a..74a19f0564419 100644 --- a/crates/store/re_types/src/components/pose_scale3d.rs +++ b/crates/store/re_types/src/components/pose_scale3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 3D scale factor that doesn't propagate in the transform hierarchy. @@ -27,44 +27,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct PoseScale3D(pub crate::datatypes::Vec3D); -impl ::re_types_core::SizeBytes for PoseScale3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for PoseScale3D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for PoseScale3D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::Deref for PoseScale3D { - type Target = crate::datatypes::Vec3D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::DerefMut for PoseScale3D { +impl ::re_types_core::Component for PoseScale3D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.PoseScale3D") } } @@ -109,9 +75,43 @@ impl ::re_types_core::Loggable for PoseScale3D { } } -impl ::re_types_core::Component for PoseScale3D { +impl> From for PoseScale3D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for PoseScale3D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::Deref for PoseScale3D { + type Target = crate::datatypes::Vec3D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::DerefMut for PoseScale3D { #[inline] - fn name() -> ComponentName { - "rerun.components.PoseScale3D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for PoseScale3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/pose_transform_mat3x3.rs b/crates/store/re_types/src/components/pose_transform_mat3x3.rs index 83d0da756fe76..2c3e21ef7ad17 100644 --- a/crates/store/re_types/src/components/pose_transform_mat3x3.rs +++ b/crates/store/re_types/src/components/pose_transform_mat3x3.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 3x3 transformation matrix Matrix that doesn't propagate in the transform hierarchy. @@ -35,44 +35,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct PoseTransformMat3x3(pub crate::datatypes::Mat3x3); -impl ::re_types_core::SizeBytes for PoseTransformMat3x3 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for PoseTransformMat3x3 { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for PoseTransformMat3x3 { - #[inline] - fn borrow(&self) -> &crate::datatypes::Mat3x3 { - &self.0 - } -} - -impl std::ops::Deref for PoseTransformMat3x3 { - type Target = crate::datatypes::Mat3x3; - - #[inline] - fn deref(&self) -> &crate::datatypes::Mat3x3 { - &self.0 - } -} - -impl std::ops::DerefMut for PoseTransformMat3x3 { +impl ::re_types_core::Component for PoseTransformMat3x3 { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Mat3x3 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.PoseTransformMat3x3") } } @@ -117,9 +83,43 @@ impl ::re_types_core::Loggable for PoseTransformMat3x3 { } } -impl ::re_types_core::Component for PoseTransformMat3x3 { +impl> From for PoseTransformMat3x3 { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for PoseTransformMat3x3 { + #[inline] + fn borrow(&self) -> &crate::datatypes::Mat3x3 { + &self.0 + } +} + +impl std::ops::Deref for PoseTransformMat3x3 { + type Target = crate::datatypes::Mat3x3; + + #[inline] + fn deref(&self) -> &crate::datatypes::Mat3x3 { + &self.0 + } +} + +impl std::ops::DerefMut for PoseTransformMat3x3 { #[inline] - fn name() -> ComponentName { - "rerun.components.PoseTransformMat3x3".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Mat3x3 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for PoseTransformMat3x3 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/pose_translation3d.rs b/crates/store/re_types/src/components/pose_translation3d.rs index 2fba1c14cfd37..5f76b2bbf061c 100644 --- a/crates/store/re_types/src/components/pose_translation3d.rs +++ b/crates/store/re_types/src/components/pose_translation3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A translation vector in 3D space that doesn't propagate in the transform hierarchy. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct PoseTranslation3D(pub crate::datatypes::Vec3D); -impl ::re_types_core::SizeBytes for PoseTranslation3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for PoseTranslation3D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for PoseTranslation3D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::Deref for PoseTranslation3D { - type Target = crate::datatypes::Vec3D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::DerefMut for PoseTranslation3D { +impl ::re_types_core::Component for PoseTranslation3D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.PoseTranslation3D") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for PoseTranslation3D { } } -impl ::re_types_core::Component for PoseTranslation3D { +impl> From for PoseTranslation3D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for PoseTranslation3D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::Deref for PoseTranslation3D { + type Target = crate::datatypes::Vec3D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::DerefMut for PoseTranslation3D { #[inline] - fn name() -> ComponentName { - "rerun.components.PoseTranslation3D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for PoseTranslation3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/position2d.rs b/crates/store/re_types/src/components/position2d.rs index a4bd51d415cb3..595ec125efd9a 100644 --- a/crates/store/re_types/src/components/position2d.rs +++ b/crates/store/re_types/src/components/position2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A position in 2D space. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Position2D(pub crate::datatypes::Vec2D); -impl ::re_types_core::SizeBytes for Position2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Position2D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Position2D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::Deref for Position2D { - type Target = crate::datatypes::Vec2D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::DerefMut for Position2D { +impl ::re_types_core::Component for Position2D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Position2D") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for Position2D { } } -impl ::re_types_core::Component for Position2D { +impl> From for Position2D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Position2D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::Deref for Position2D { + type Target = crate::datatypes::Vec2D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::DerefMut for Position2D { #[inline] - fn name() -> ComponentName { - "rerun.components.Position2D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Position2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/position3d.rs b/crates/store/re_types/src/components/position3d.rs index 959582b1e83a9..d47ffb8b5bbb3 100644 --- a/crates/store/re_types/src/components/position3d.rs +++ b/crates/store/re_types/src/components/position3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A position in 3D space. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Position3D(pub crate::datatypes::Vec3D); -impl ::re_types_core::SizeBytes for Position3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Position3D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Position3D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::Deref for Position3D { - type Target = crate::datatypes::Vec3D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::DerefMut for Position3D { +impl ::re_types_core::Component for Position3D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Position3D") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for Position3D { } } -impl ::re_types_core::Component for Position3D { +impl> From for Position3D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Position3D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::Deref for Position3D { + type Target = crate::datatypes::Vec3D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::DerefMut for Position3D { #[inline] - fn name() -> ComponentName { - "rerun.components.Position3D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Position3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/radius.rs b/crates/store/re_types/src/components/radius.rs index a835ec36faed0..a1608a9dc2aa4 100644 --- a/crates/store/re_types/src/components/radius.rs +++ b/crates/store/re_types/src/components/radius.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The radius of something, e.g. a point. @@ -30,44 +30,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Radius(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for Radius { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Radius { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Radius { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for Radius { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for Radius { +impl ::re_types_core::Component for Radius { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Radius") } } @@ -112,9 +78,43 @@ impl ::re_types_core::Loggable for Radius { } } -impl ::re_types_core::Component for Radius { +impl> From for Radius { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Radius { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for Radius { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for Radius { #[inline] - fn name() -> ComponentName { - "rerun.components.Radius".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Radius { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/range1d.rs b/crates/store/re_types/src/components/range1d.rs index 8126bd996ea45..13e8c2bad4efc 100644 --- a/crates/store/re_types/src/components/range1d.rs +++ b/crates/store/re_types/src/components/range1d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 1D range, specifying a lower and upper bound. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Range1D(pub crate::datatypes::Range1D); -impl ::re_types_core::SizeBytes for Range1D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Range1D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Range1D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Range1D { - &self.0 - } -} - -impl std::ops::Deref for Range1D { - type Target = crate::datatypes::Range1D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Range1D { - &self.0 - } -} - -impl std::ops::DerefMut for Range1D { +impl ::re_types_core::Component for Range1D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Range1D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Range1D") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for Range1D { } } -impl ::re_types_core::Component for Range1D { +impl> From for Range1D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Range1D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Range1D { + &self.0 + } +} + +impl std::ops::Deref for Range1D { + type Target = crate::datatypes::Range1D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Range1D { + &self.0 + } +} + +impl std::ops::DerefMut for Range1D { #[inline] - fn name() -> ComponentName { - "rerun.components.Range1D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Range1D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Range1D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/recording_uri.rs b/crates/store/re_types/src/components/recording_uri.rs index 9f3c09c9693ef..f86b0daa77750 100644 --- a/crates/store/re_types/src/components/recording_uri.rs +++ b/crates/store/re_types/src/components/recording_uri.rs @@ -13,24 +13,52 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A recording URI (Uniform Resource Identifier). #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct RecordingUri(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for RecordingUri { +impl ::re_types_core::Component for RecordingUri { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.RecordingUri") } +} +::re_types_core::macros::impl_into_cow!(RecordingUri); + +impl ::re_types_core::Loggable for RecordingUri { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -63,42 +91,14 @@ impl std::ops::DerefMut for RecordingUri { } } -::re_types_core::macros::impl_into_cow!(RecordingUri); - -impl ::re_types_core::Loggable for RecordingUri { +impl ::re_types_core::SizeBytes for RecordingUri { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for RecordingUri { #[inline] - fn name() -> ComponentName { - "rerun.components.RecordingUri".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/resolution.rs b/crates/store/re_types/src/components/resolution.rs index 391bf37f9a0ce..1c2d81d11842f 100644 --- a/crates/store/re_types/src/components/resolution.rs +++ b/crates/store/re_types/src/components/resolution.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Pixel resolution width & height, e.g. of a camera sensor. @@ -24,44 +24,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Copy, PartialEq)] pub struct Resolution(pub crate::datatypes::Vec2D); -impl ::re_types_core::SizeBytes for Resolution { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Resolution { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Resolution { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::Deref for Resolution { - type Target = crate::datatypes::Vec2D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::DerefMut for Resolution { +impl ::re_types_core::Component for Resolution { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Resolution") } } @@ -106,9 +72,43 @@ impl ::re_types_core::Loggable for Resolution { } } -impl ::re_types_core::Component for Resolution { +impl> From for Resolution { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Resolution { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::Deref for Resolution { + type Target = crate::datatypes::Vec2D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::DerefMut for Resolution { #[inline] - fn name() -> ComponentName { - "rerun.components.Resolution".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Resolution { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/rotation_axis_angle.rs b/crates/store/re_types/src/components/rotation_axis_angle.rs index 494c8c726f0aa..4dd67591c12e6 100644 --- a/crates/store/re_types/src/components/rotation_axis_angle.rs +++ b/crates/store/re_types/src/components/rotation_axis_angle.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: 3D rotation represented by a rotation around a given axis. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct RotationAxisAngle(pub crate::datatypes::RotationAxisAngle); -impl ::re_types_core::SizeBytes for RotationAxisAngle { +impl ::re_types_core::Component for RotationAxisAngle { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.RotationAxisAngle") } +} +::re_types_core::macros::impl_into_cow!(RotationAxisAngle); + +impl ::re_types_core::Loggable for RotationAxisAngle { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::RotationAxisAngle::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::RotationAxisAngle::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::RotationAxisAngle::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for RotationAxisAngle { } } -::re_types_core::macros::impl_into_cow!(RotationAxisAngle); - -impl ::re_types_core::Loggable for RotationAxisAngle { +impl ::re_types_core::SizeBytes for RotationAxisAngle { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::RotationAxisAngle::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::RotationAxisAngle::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::RotationAxisAngle::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for RotationAxisAngle { #[inline] - fn name() -> ComponentName { - "rerun.components.RotationAxisAngle".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/rotation_quat.rs b/crates/store/re_types/src/components/rotation_quat.rs index 796fb844cb593..4bbc927b359a7 100644 --- a/crates/store/re_types/src/components/rotation_quat.rs +++ b/crates/store/re_types/src/components/rotation_quat.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 3D rotation expressed as a quaternion. @@ -26,44 +26,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct RotationQuat(pub crate::datatypes::Quaternion); -impl ::re_types_core::SizeBytes for RotationQuat { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for RotationQuat { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for RotationQuat { - #[inline] - fn borrow(&self) -> &crate::datatypes::Quaternion { - &self.0 - } -} - -impl std::ops::Deref for RotationQuat { - type Target = crate::datatypes::Quaternion; - - #[inline] - fn deref(&self) -> &crate::datatypes::Quaternion { - &self.0 - } -} - -impl std::ops::DerefMut for RotationQuat { +impl ::re_types_core::Component for RotationQuat { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Quaternion { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.RotationQuat") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for RotationQuat { } } -impl ::re_types_core::Component for RotationQuat { +impl> From for RotationQuat { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for RotationQuat { + #[inline] + fn borrow(&self) -> &crate::datatypes::Quaternion { + &self.0 + } +} + +impl std::ops::Deref for RotationQuat { + type Target = crate::datatypes::Quaternion; + + #[inline] + fn deref(&self) -> &crate::datatypes::Quaternion { + &self.0 + } +} + +impl std::ops::DerefMut for RotationQuat { #[inline] - fn name() -> ComponentName { - "rerun.components.RotationQuat".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Quaternion { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for RotationQuat { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/scalar.rs b/crates/store/re_types/src/components/scalar.rs index 1058e369e2d63..5ac098513b1bc 100644 --- a/crates/store/re_types/src/components/scalar.rs +++ b/crates/store/re_types/src/components/scalar.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A scalar value, encoded as a 64-bit floating point. @@ -25,44 +25,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Scalar(pub crate::datatypes::Float64); -impl ::re_types_core::SizeBytes for Scalar { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Scalar { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Scalar { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float64 { - &self.0 - } -} - -impl std::ops::Deref for Scalar { - type Target = crate::datatypes::Float64; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float64 { - &self.0 - } -} - -impl std::ops::DerefMut for Scalar { +impl ::re_types_core::Component for Scalar { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float64 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Scalar") } } @@ -107,9 +73,43 @@ impl ::re_types_core::Loggable for Scalar { } } -impl ::re_types_core::Component for Scalar { +impl> From for Scalar { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Scalar { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float64 { + &self.0 + } +} + +impl std::ops::Deref for Scalar { + type Target = crate::datatypes::Float64; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float64 { + &self.0 + } +} + +impl std::ops::DerefMut for Scalar { #[inline] - fn name() -> ComponentName { - "rerun.components.Scalar".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float64 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Scalar { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/scale3d.rs b/crates/store/re_types/src/components/scale3d.rs index 3ff9af13e1072..37117a39e3e14 100644 --- a/crates/store/re_types/src/components/scale3d.rs +++ b/crates/store/re_types/src/components/scale3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 3D scale factor. @@ -27,44 +27,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Scale3D(pub crate::datatypes::Vec3D); -impl ::re_types_core::SizeBytes for Scale3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Scale3D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Scale3D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::Deref for Scale3D { - type Target = crate::datatypes::Vec3D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::DerefMut for Scale3D { +impl ::re_types_core::Component for Scale3D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Scale3D") } } @@ -109,9 +75,43 @@ impl ::re_types_core::Loggable for Scale3D { } } -impl ::re_types_core::Component for Scale3D { +impl> From for Scale3D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Scale3D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::Deref for Scale3D { + type Target = crate::datatypes::Vec3D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::DerefMut for Scale3D { #[inline] - fn name() -> ComponentName { - "rerun.components.Scale3D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Scale3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/show_labels.rs b/crates/store/re_types/src/components/show_labels.rs index b20c59d4b5178..9977658687d51 100644 --- a/crates/store/re_types/src/components/show_labels.rs +++ b/crates/store/re_types/src/components/show_labels.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Whether the entity's [`components::Text`][crate::components::Text] label is shown. @@ -29,15 +29,43 @@ pub struct ShowLabels( pub crate::datatypes::Bool, ); -impl ::re_types_core::SizeBytes for ShowLabels { +impl ::re_types_core::Component for ShowLabels { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.ShowLabels") } +} +::re_types_core::macros::impl_into_cow!(ShowLabels); + +impl ::re_types_core::Loggable for ShowLabels { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -70,42 +98,14 @@ impl std::ops::DerefMut for ShowLabels { } } -::re_types_core::macros::impl_into_cow!(ShowLabels); - -impl ::re_types_core::Loggable for ShowLabels { +impl ::re_types_core::SizeBytes for ShowLabels { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for ShowLabels { #[inline] - fn name() -> ComponentName { - "rerun.components.ShowLabels".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/stroke_width.rs b/crates/store/re_types/src/components/stroke_width.rs index 5a6f522cc9948..1e4d2ed720363 100644 --- a/crates/store/re_types/src/components/stroke_width.rs +++ b/crates/store/re_types/src/components/stroke_width.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The width of a stroke specified in UI points. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct StrokeWidth(pub crate::datatypes::Float32); -impl ::re_types_core::SizeBytes for StrokeWidth { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for StrokeWidth { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for StrokeWidth { - #[inline] - fn borrow(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::Deref for StrokeWidth { - type Target = crate::datatypes::Float32; - - #[inline] - fn deref(&self) -> &crate::datatypes::Float32 { - &self.0 - } -} - -impl std::ops::DerefMut for StrokeWidth { +impl ::re_types_core::Component for StrokeWidth { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.StrokeWidth") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for StrokeWidth { } } -impl ::re_types_core::Component for StrokeWidth { +impl> From for StrokeWidth { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for StrokeWidth { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for StrokeWidth { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for StrokeWidth { #[inline] - fn name() -> ComponentName { - "rerun.components.StrokeWidth".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for StrokeWidth { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/tensor_data.rs b/crates/store/re_types/src/components/tensor_data.rs index 2faca36bb69e2..132977b5a683a 100644 --- a/crates/store/re_types/src/components/tensor_data.rs +++ b/crates/store/re_types/src/components/tensor_data.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: An N-dimensional array of numbers. @@ -30,15 +30,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TensorData(pub crate::datatypes::TensorData); -impl ::re_types_core::SizeBytes for TensorData { +impl ::re_types_core::Component for TensorData { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.TensorData") } +} +::re_types_core::macros::impl_into_cow!(TensorData); + +impl ::re_types_core::Loggable for TensorData { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::TensorData::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::TensorData::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::TensorData::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -71,42 +99,14 @@ impl std::ops::DerefMut for TensorData { } } -::re_types_core::macros::impl_into_cow!(TensorData); - -impl ::re_types_core::Loggable for TensorData { +impl ::re_types_core::SizeBytes for TensorData { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::TensorData::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::TensorData::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::TensorData::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for TensorData { #[inline] - fn name() -> ComponentName { - "rerun.components.TensorData".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/tensor_dimension_index_selection.rs b/crates/store/re_types/src/components/tensor_dimension_index_selection.rs index 01ede1b23e6c6..0286a2469ce8d 100644 --- a/crates/store/re_types/src/components/tensor_dimension_index_selection.rs +++ b/crates/store/re_types/src/components/tensor_dimension_index_selection.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Specifies a concrete index on a tensor dimension. @@ -23,15 +23,45 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TensorDimensionIndexSelection(pub crate::datatypes::TensorDimensionIndexSelection); -impl ::re_types_core::SizeBytes for TensorDimensionIndexSelection { +impl ::re_types_core::Component for TensorDimensionIndexSelection { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.TensorDimensionIndexSelection") } +} +::re_types_core::macros::impl_into_cow!(TensorDimensionIndexSelection); + +impl ::re_types_core::Loggable for TensorDimensionIndexSelection { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::TensorDimensionIndexSelection::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::TensorDimensionIndexSelection::to_arrow_opt(data.into_iter().map( + |datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + }, + )) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::TensorDimensionIndexSelection::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -68,44 +98,14 @@ impl std::ops::DerefMut for TensorDimensionIndexSelection { } } -::re_types_core::macros::impl_into_cow!(TensorDimensionIndexSelection); - -impl ::re_types_core::Loggable for TensorDimensionIndexSelection { +impl ::re_types_core::SizeBytes for TensorDimensionIndexSelection { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::TensorDimensionIndexSelection::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::TensorDimensionIndexSelection::to_arrow_opt(data.into_iter().map( - |datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - }, - )) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::TensorDimensionIndexSelection::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for TensorDimensionIndexSelection { #[inline] - fn name() -> ComponentName { - "rerun.components.TensorDimensionIndexSelection".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/tensor_height_dimension.rs b/crates/store/re_types/src/components/tensor_height_dimension.rs index 119c5933267f9..b5ef70edcbfa7 100644 --- a/crates/store/re_types/src/components/tensor_height_dimension.rs +++ b/crates/store/re_types/src/components/tensor_height_dimension.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Specifies which dimension to use for height. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TensorHeightDimension(pub crate::datatypes::TensorDimensionSelection); -impl ::re_types_core::SizeBytes for TensorHeightDimension { +impl ::re_types_core::Component for TensorHeightDimension { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.TensorHeightDimension") } +} +::re_types_core::macros::impl_into_cow!(TensorHeightDimension); + +impl ::re_types_core::Loggable for TensorHeightDimension { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::TensorDimensionSelection::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::TensorDimensionSelection::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::TensorDimensionSelection::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for TensorHeightDimension { } } -::re_types_core::macros::impl_into_cow!(TensorHeightDimension); - -impl ::re_types_core::Loggable for TensorHeightDimension { +impl ::re_types_core::SizeBytes for TensorHeightDimension { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::TensorDimensionSelection::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::TensorDimensionSelection::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::TensorDimensionSelection::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for TensorHeightDimension { #[inline] - fn name() -> ComponentName { - "rerun.components.TensorHeightDimension".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/tensor_width_dimension.rs b/crates/store/re_types/src/components/tensor_width_dimension.rs index fc7da7124b9b0..1d55fcefb3990 100644 --- a/crates/store/re_types/src/components/tensor_width_dimension.rs +++ b/crates/store/re_types/src/components/tensor_width_dimension.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Specifies which dimension to use for width. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TensorWidthDimension(pub crate::datatypes::TensorDimensionSelection); -impl ::re_types_core::SizeBytes for TensorWidthDimension { +impl ::re_types_core::Component for TensorWidthDimension { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.TensorWidthDimension") } +} +::re_types_core::macros::impl_into_cow!(TensorWidthDimension); + +impl ::re_types_core::Loggable for TensorWidthDimension { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::TensorDimensionSelection::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::TensorDimensionSelection::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::TensorDimensionSelection::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for TensorWidthDimension { } } -::re_types_core::macros::impl_into_cow!(TensorWidthDimension); - -impl ::re_types_core::Loggable for TensorWidthDimension { +impl ::re_types_core::SizeBytes for TensorWidthDimension { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::TensorDimensionSelection::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::TensorDimensionSelection::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::TensorDimensionSelection::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for TensorWidthDimension { #[inline] - fn name() -> ComponentName { - "rerun.components.TensorWidthDimension".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/texcoord2d.rs b/crates/store/re_types/src/components/texcoord2d.rs index ff9ea66ed5fea..071effa2155d6 100644 --- a/crates/store/re_types/src/components/texcoord2d.rs +++ b/crates/store/re_types/src/components/texcoord2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 2D texture UV coordinate. @@ -38,44 +38,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Texcoord2D(pub crate::datatypes::Vec2D); -impl ::re_types_core::SizeBytes for Texcoord2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Texcoord2D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Texcoord2D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::Deref for Texcoord2D { - type Target = crate::datatypes::Vec2D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::DerefMut for Texcoord2D { +impl ::re_types_core::Component for Texcoord2D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Texcoord2D") } } @@ -120,9 +86,43 @@ impl ::re_types_core::Loggable for Texcoord2D { } } -impl ::re_types_core::Component for Texcoord2D { +impl> From for Texcoord2D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Texcoord2D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::Deref for Texcoord2D { + type Target = crate::datatypes::Vec2D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::DerefMut for Texcoord2D { #[inline] - fn name() -> ComponentName { - "rerun.components.Texcoord2D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Texcoord2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/text.rs b/crates/store/re_types/src/components/text.rs index 14829ca69e11f..deff7100f9f74 100644 --- a/crates/store/re_types/src/components/text.rs +++ b/crates/store/re_types/src/components/text.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A string of text, e.g. for labels and text documents. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Text(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for Text { +impl ::re_types_core::Component for Text { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Text") } +} +::re_types_core::macros::impl_into_cow!(Text); + +impl ::re_types_core::Loggable for Text { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for Text { } } -::re_types_core::macros::impl_into_cow!(Text); - -impl ::re_types_core::Loggable for Text { +impl ::re_types_core::SizeBytes for Text { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for Text { #[inline] - fn name() -> ComponentName { - "rerun.components.Text".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/text_log_level.rs b/crates/store/re_types/src/components/text_log_level.rs index 8cb71910bb959..de37dafc18afc 100644 --- a/crates/store/re_types/src/components/text_log_level.rs +++ b/crates/store/re_types/src/components/text_log_level.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The severity level of a text log message. @@ -31,15 +31,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TextLogLevel(pub crate::datatypes::Utf8); -impl ::re_types_core::SizeBytes for TextLogLevel { +impl ::re_types_core::Component for TextLogLevel { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.TextLogLevel") } +} +::re_types_core::macros::impl_into_cow!(TextLogLevel); + +impl ::re_types_core::Loggable for TextLogLevel { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Utf8::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Utf8::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -72,42 +100,14 @@ impl std::ops::DerefMut for TextLogLevel { } } -::re_types_core::macros::impl_into_cow!(TextLogLevel); - -impl ::re_types_core::Loggable for TextLogLevel { +impl ::re_types_core::SizeBytes for TextLogLevel { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Utf8::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Utf8::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Utf8::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for TextLogLevel { #[inline] - fn name() -> ComponentName { - "rerun.components.TextLogLevel".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/transform_mat3x3.rs b/crates/store/re_types/src/components/transform_mat3x3.rs index c60364a8cb212..2523d4cd96efd 100644 --- a/crates/store/re_types/src/components/transform_mat3x3.rs +++ b/crates/store/re_types/src/components/transform_mat3x3.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A 3x3 transformation matrix Matrix. @@ -35,44 +35,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TransformMat3x3(pub crate::datatypes::Mat3x3); -impl ::re_types_core::SizeBytes for TransformMat3x3 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for TransformMat3x3 { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for TransformMat3x3 { - #[inline] - fn borrow(&self) -> &crate::datatypes::Mat3x3 { - &self.0 - } -} - -impl std::ops::Deref for TransformMat3x3 { - type Target = crate::datatypes::Mat3x3; - - #[inline] - fn deref(&self) -> &crate::datatypes::Mat3x3 { - &self.0 - } -} - -impl std::ops::DerefMut for TransformMat3x3 { +impl ::re_types_core::Component for TransformMat3x3 { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Mat3x3 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.TransformMat3x3") } } @@ -117,9 +83,43 @@ impl ::re_types_core::Loggable for TransformMat3x3 { } } -impl ::re_types_core::Component for TransformMat3x3 { +impl> From for TransformMat3x3 { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for TransformMat3x3 { + #[inline] + fn borrow(&self) -> &crate::datatypes::Mat3x3 { + &self.0 + } +} + +impl std::ops::Deref for TransformMat3x3 { + type Target = crate::datatypes::Mat3x3; + + #[inline] + fn deref(&self) -> &crate::datatypes::Mat3x3 { + &self.0 + } +} + +impl std::ops::DerefMut for TransformMat3x3 { #[inline] - fn name() -> ComponentName { - "rerun.components.TransformMat3x3".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Mat3x3 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for TransformMat3x3 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/transform_relation.rs b/crates/store/re_types/src/components/transform_relation.rs index 16f317bf4c5bd..a389d87c7447f 100644 --- a/crates/store/re_types/src/components/transform_relation.rs +++ b/crates/store/re_types/src/components/transform_relation.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Specifies relation a spatial transform describes. @@ -39,43 +39,10 @@ pub enum TransformRelation { ChildFromParent = 2, } -impl ::re_types_core::reflection::Enum for TransformRelation { - #[inline] - fn variants() -> &'static [Self] { - &[Self::ParentFromChild, Self::ChildFromParent] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::ParentFromChild => { - "The transform describes how to transform into the parent entity's space.\n\nE.g. a translation of (0, 1, 0) with this [`components::TransformRelation`][crate::components::TransformRelation] logged at `parent/child` means\nthat from the point of view of `parent`, `parent/child` is translated 1 unit along `parent`'s Y axis.\nFrom perspective of `parent/child`, the `parent` entity is translated -1 unit along `parent/child`'s Y axis." - } - Self::ChildFromParent => { - "The transform describes how to transform into the child entity's space.\n\nE.g. a translation of (0, 1, 0) with this [`components::TransformRelation`][crate::components::TransformRelation] logged at `parent/child` means\nthat from the point of view of `parent`, `parent/child` is translated -1 unit along `parent`'s Y axis.\nFrom perspective of `parent/child`, the `parent` entity is translated 1 unit along `parent/child`'s Y axis." - } - } - } -} - -impl ::re_types_core::SizeBytes for TransformRelation { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for TransformRelation { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for TransformRelation { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::ParentFromChild => write!(f, "ParentFromChild"), - Self::ChildFromParent => write!(f, "ChildFromParent"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.TransformRelation") } } @@ -165,9 +132,42 @@ impl ::re_types_core::Loggable for TransformRelation { } } -impl ::re_types_core::Component for TransformRelation { +impl std::fmt::Display for TransformRelation { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::ParentFromChild => write!(f, "ParentFromChild"), + Self::ChildFromParent => write!(f, "ChildFromParent"), + } + } +} + +impl ::re_types_core::reflection::Enum for TransformRelation { #[inline] - fn name() -> ComponentName { - "rerun.components.TransformRelation".into() + fn variants() -> &'static [Self] { + &[Self::ParentFromChild, Self::ChildFromParent] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::ParentFromChild => { + "The transform describes how to transform into the parent entity's space.\n\nE.g. a translation of (0, 1, 0) with this [`components::TransformRelation`][crate::components::TransformRelation] logged at `parent/child` means\nthat from the point of view of `parent`, `parent/child` is translated 1 unit along `parent`'s Y axis.\nFrom perspective of `parent/child`, the `parent` entity is translated -1 unit along `parent/child`'s Y axis." + } + Self::ChildFromParent => { + "The transform describes how to transform into the child entity's space.\n\nE.g. a translation of (0, 1, 0) with this [`components::TransformRelation`][crate::components::TransformRelation] logged at `parent/child` means\nthat from the point of view of `parent`, `parent/child` is translated -1 unit along `parent`'s Y axis.\nFrom perspective of `parent/child`, the `parent` entity is translated 1 unit along `parent/child`'s Y axis." + } + } + } +} + +impl ::re_types_core::SizeBytes for TransformRelation { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types/src/components/translation3d.rs b/crates/store/re_types/src/components/translation3d.rs index 8c7bbe48e03aa..c07163ff2e8a0 100644 --- a/crates/store/re_types/src/components/translation3d.rs +++ b/crates/store/re_types/src/components/translation3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A translation vector in 3D space. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Translation3D(pub crate::datatypes::Vec3D); -impl ::re_types_core::SizeBytes for Translation3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Translation3D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Translation3D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::Deref for Translation3D { - type Target = crate::datatypes::Vec3D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::DerefMut for Translation3D { +impl ::re_types_core::Component for Translation3D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Translation3D") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for Translation3D { } } -impl ::re_types_core::Component for Translation3D { +impl> From for Translation3D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Translation3D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::Deref for Translation3D { + type Target = crate::datatypes::Vec3D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::DerefMut for Translation3D { #[inline] - fn name() -> ComponentName { - "rerun.components.Translation3D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Translation3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/triangle_indices.rs b/crates/store/re_types/src/components/triangle_indices.rs index f22283f0c1a78..71ea8278d1223 100644 --- a/crates/store/re_types/src/components/triangle_indices.rs +++ b/crates/store/re_types/src/components/triangle_indices.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The three indices of a triangle in a triangle mesh. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct TriangleIndices(pub crate::datatypes::UVec3D); -impl ::re_types_core::SizeBytes for TriangleIndices { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for TriangleIndices { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for TriangleIndices { - #[inline] - fn borrow(&self) -> &crate::datatypes::UVec3D { - &self.0 - } -} - -impl std::ops::Deref for TriangleIndices { - type Target = crate::datatypes::UVec3D; - - #[inline] - fn deref(&self) -> &crate::datatypes::UVec3D { - &self.0 - } -} - -impl std::ops::DerefMut for TriangleIndices { +impl ::re_types_core::Component for TriangleIndices { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::UVec3D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.TriangleIndices") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for TriangleIndices { } } -impl ::re_types_core::Component for TriangleIndices { +impl> From for TriangleIndices { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for TriangleIndices { + #[inline] + fn borrow(&self) -> &crate::datatypes::UVec3D { + &self.0 + } +} + +impl std::ops::Deref for TriangleIndices { + type Target = crate::datatypes::UVec3D; + + #[inline] + fn deref(&self) -> &crate::datatypes::UVec3D { + &self.0 + } +} + +impl std::ops::DerefMut for TriangleIndices { #[inline] - fn name() -> ComponentName { - "rerun.components.TriangleIndices".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::UVec3D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for TriangleIndices { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/value_range.rs b/crates/store/re_types/src/components/value_range.rs index d4dc347e9e86a..f1cedc560c5a1 100644 --- a/crates/store/re_types/src/components/value_range.rs +++ b/crates/store/re_types/src/components/value_range.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Range of expected or valid values, specifying a lower and upper bound. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct ValueRange(pub crate::datatypes::Range1D); -impl ::re_types_core::SizeBytes for ValueRange { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for ValueRange { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for ValueRange { - #[inline] - fn borrow(&self) -> &crate::datatypes::Range1D { - &self.0 - } -} - -impl std::ops::Deref for ValueRange { - type Target = crate::datatypes::Range1D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Range1D { - &self.0 - } -} - -impl std::ops::DerefMut for ValueRange { +impl ::re_types_core::Component for ValueRange { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Range1D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.ValueRange") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for ValueRange { } } -impl ::re_types_core::Component for ValueRange { +impl> From for ValueRange { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ValueRange { + #[inline] + fn borrow(&self) -> &crate::datatypes::Range1D { + &self.0 + } +} + +impl std::ops::Deref for ValueRange { + type Target = crate::datatypes::Range1D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Range1D { + &self.0 + } +} + +impl std::ops::DerefMut for ValueRange { #[inline] - fn name() -> ComponentName { - "rerun.components.ValueRange".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Range1D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ValueRange { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/vector2d.rs b/crates/store/re_types/src/components/vector2d.rs index 6769f40a04ac0..4422354c594f7 100644 --- a/crates/store/re_types/src/components/vector2d.rs +++ b/crates/store/re_types/src/components/vector2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A vector in 2D space. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Vector2D(pub crate::datatypes::Vec2D); -impl ::re_types_core::SizeBytes for Vector2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Vector2D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Vector2D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::Deref for Vector2D { - type Target = crate::datatypes::Vec2D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec2D { - &self.0 - } -} - -impl std::ops::DerefMut for Vector2D { +impl ::re_types_core::Component for Vector2D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Vector2D") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for Vector2D { } } -impl ::re_types_core::Component for Vector2D { +impl> From for Vector2D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Vector2D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::Deref for Vector2D { + type Target = crate::datatypes::Vec2D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec2D { + &self.0 + } +} + +impl std::ops::DerefMut for Vector2D { #[inline] - fn name() -> ComponentName { - "rerun.components.Vector2D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Vector2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/vector3d.rs b/crates/store/re_types/src/components/vector3d.rs index 42ca53ba7c375..0049900c3755b 100644 --- a/crates/store/re_types/src/components/vector3d.rs +++ b/crates/store/re_types/src/components/vector3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A vector in 3D space. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Vector3D(pub crate::datatypes::Vec3D); -impl ::re_types_core::SizeBytes for Vector3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for Vector3D { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for Vector3D { - #[inline] - fn borrow(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::Deref for Vector3D { - type Target = crate::datatypes::Vec3D; - - #[inline] - fn deref(&self) -> &crate::datatypes::Vec3D { - &self.0 - } -} - -impl std::ops::DerefMut for Vector3D { +impl ::re_types_core::Component for Vector3D { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.Vector3D") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for Vector3D { } } -impl ::re_types_core::Component for Vector3D { +impl> From for Vector3D { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Vector3D { + #[inline] + fn borrow(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::Deref for Vector3D { + type Target = crate::datatypes::Vec3D; + + #[inline] + fn deref(&self) -> &crate::datatypes::Vec3D { + &self.0 + } +} + +impl std::ops::DerefMut for Vector3D { #[inline] - fn name() -> ComponentName { - "rerun.components.Vector3D".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Vec3D { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Vector3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/video_timestamp.rs b/crates/store/re_types/src/components/video_timestamp.rs index 96b6d1cc4d2a8..1c02183c7abae 100644 --- a/crates/store/re_types/src/components/video_timestamp.rs +++ b/crates/store/re_types/src/components/video_timestamp.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Timestamp inside a [`archetypes::AssetVideo`][crate::archetypes::AssetVideo]. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct VideoTimestamp(pub crate::datatypes::VideoTimestamp); -impl ::re_types_core::SizeBytes for VideoTimestamp { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for VideoTimestamp { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for VideoTimestamp { - #[inline] - fn borrow(&self) -> &crate::datatypes::VideoTimestamp { - &self.0 - } -} - -impl std::ops::Deref for VideoTimestamp { - type Target = crate::datatypes::VideoTimestamp; - - #[inline] - fn deref(&self) -> &crate::datatypes::VideoTimestamp { - &self.0 - } -} - -impl std::ops::DerefMut for VideoTimestamp { +impl ::re_types_core::Component for VideoTimestamp { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::VideoTimestamp { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.VideoTimestamp") } } @@ -106,9 +72,43 @@ impl ::re_types_core::Loggable for VideoTimestamp { } } -impl ::re_types_core::Component for VideoTimestamp { +impl> From for VideoTimestamp { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for VideoTimestamp { + #[inline] + fn borrow(&self) -> &crate::datatypes::VideoTimestamp { + &self.0 + } +} + +impl std::ops::Deref for VideoTimestamp { + type Target = crate::datatypes::VideoTimestamp; + + #[inline] + fn deref(&self) -> &crate::datatypes::VideoTimestamp { + &self.0 + } +} + +impl std::ops::DerefMut for VideoTimestamp { #[inline] - fn name() -> ComponentName { - "rerun.components.VideoTimestamp".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::VideoTimestamp { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for VideoTimestamp { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/components/view_coordinates.rs b/crates/store/re_types/src/components/view_coordinates.rs index 4160466dc8560..b246962d5428e 100644 --- a/crates/store/re_types/src/components/view_coordinates.rs +++ b/crates/store/re_types/src/components/view_coordinates.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: How we interpret the coordinate system of an entity/space. @@ -43,44 +43,10 @@ pub struct ViewCoordinates( pub crate::datatypes::ViewCoordinates, ); -impl ::re_types_core::SizeBytes for ViewCoordinates { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for ViewCoordinates { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for ViewCoordinates { - #[inline] - fn borrow(&self) -> &crate::datatypes::ViewCoordinates { - &self.0 - } -} - -impl std::ops::Deref for ViewCoordinates { - type Target = crate::datatypes::ViewCoordinates; - - #[inline] - fn deref(&self) -> &crate::datatypes::ViewCoordinates { - &self.0 - } -} - -impl std::ops::DerefMut for ViewCoordinates { +impl ::re_types_core::Component for ViewCoordinates { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::ViewCoordinates { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.ViewCoordinates") } } @@ -125,9 +91,43 @@ impl ::re_types_core::Loggable for ViewCoordinates { } } -impl ::re_types_core::Component for ViewCoordinates { +impl> From for ViewCoordinates { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ViewCoordinates { + #[inline] + fn borrow(&self) -> &crate::datatypes::ViewCoordinates { + &self.0 + } +} + +impl std::ops::Deref for ViewCoordinates { + type Target = crate::datatypes::ViewCoordinates; + + #[inline] + fn deref(&self) -> &crate::datatypes::ViewCoordinates { + &self.0 + } +} + +impl std::ops::DerefMut for ViewCoordinates { #[inline] - fn name() -> ComponentName { - "rerun.components.ViewCoordinates".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::ViewCoordinates { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ViewCoordinates { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/datatypes/angle.rs b/crates/store/re_types/src/datatypes/angle.rs index a75e60af9a220..5b47bba679317 100644 --- a/crates/store/re_types/src/datatypes/angle.rs +++ b/crates/store/re_types/src/datatypes/angle.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Angle in radians. @@ -26,32 +26,6 @@ pub struct Angle { pub radians: f32, } -impl ::re_types_core::SizeBytes for Angle { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.radians.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for Angle { - #[inline] - fn from(radians: f32) -> Self { - Self { radians } - } -} - -impl From for f32 { - #[inline] - fn from(value: Angle) -> Self { - value.radians - } -} - ::re_types_core::macros::impl_into_cow!(Angle); impl ::re_types_core::Loggable for Angle { @@ -166,3 +140,29 @@ impl ::re_types_core::Loggable for Angle { }) } } + +impl From for Angle { + #[inline] + fn from(radians: f32) -> Self { + Self { radians } + } +} + +impl From for f32 { + #[inline] + fn from(value: Angle) -> Self { + value.radians + } +} + +impl ::re_types_core::SizeBytes for Angle { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.radians.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/annotation_info.rs b/crates/store/re_types/src/datatypes/annotation_info.rs index 110da98b4dc1b..f8256bf136a27 100644 --- a/crates/store/re_types/src/datatypes/annotation_info.rs +++ b/crates/store/re_types/src/datatypes/annotation_info.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Annotation info annotating a class id or key-point id. @@ -34,20 +34,6 @@ pub struct AnnotationInfo { pub color: Option, } -impl ::re_types_core::SizeBytes for AnnotationInfo { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.id.heap_size_bytes() + self.label.heap_size_bytes() + self.color.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && >::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(AnnotationInfo); impl ::re_types_core::Loggable for AnnotationInfo { @@ -327,3 +313,17 @@ impl ::re_types_core::Loggable for AnnotationInfo { }) } } + +impl ::re_types_core::SizeBytes for AnnotationInfo { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.id.heap_size_bytes() + self.label.heap_size_bytes() + self.color.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/blob.rs b/crates/store/re_types/src/datatypes/blob.rs index b102046ddfcf6..fed443bc3657f 100644 --- a/crates/store/re_types/src/datatypes/blob.rs +++ b/crates/store/re_types/src/datatypes/blob.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A binary blob of data. @@ -25,32 +25,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Blob(pub ::re_types_core::ArrowBuffer); -impl ::re_types_core::SizeBytes for Blob { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <::re_types_core::ArrowBuffer>::is_pod() - } -} - -impl From<::re_types_core::ArrowBuffer> for Blob { - #[inline] - fn from(data: ::re_types_core::ArrowBuffer) -> Self { - Self(data) - } -} - -impl From for ::re_types_core::ArrowBuffer { - #[inline] - fn from(value: Blob) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Blob); impl ::re_types_core::Loggable for Blob { @@ -194,3 +168,29 @@ impl ::re_types_core::Loggable for Blob { .with_context("rerun.datatypes.Blob")?) } } + +impl From<::re_types_core::ArrowBuffer> for Blob { + #[inline] + fn from(data: ::re_types_core::ArrowBuffer) -> Self { + Self(data) + } +} + +impl From for ::re_types_core::ArrowBuffer { + #[inline] + fn from(value: Blob) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Blob { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <::re_types_core::ArrowBuffer>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/channel_datatype.rs b/crates/store/re_types/src/datatypes/channel_datatype.rs index c3f52fe3a00e7..3d1f0bab58976 100644 --- a/crates/store/re_types/src/datatypes/channel_datatype.rs +++ b/crates/store/re_types/src/datatypes/channel_datatype.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: The innermost datatype of an image. @@ -60,72 +60,6 @@ pub enum ChannelDatatype { F64 = 35, } -impl ::re_types_core::reflection::Enum for ChannelDatatype { - #[inline] - fn variants() -> &'static [Self] { - &[ - Self::U8, - Self::I8, - Self::U16, - Self::I16, - Self::U32, - Self::I32, - Self::U64, - Self::I64, - Self::F16, - Self::F32, - Self::F64, - ] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::U8 => "8-bit unsigned integer.", - Self::I8 => "8-bit signed integer.", - Self::U16 => "16-bit unsigned integer.", - Self::I16 => "16-bit signed integer.", - Self::U32 => "32-bit unsigned integer.", - Self::I32 => "32-bit signed integer.", - Self::U64 => "64-bit unsigned integer.", - Self::I64 => "64-bit signed integer.", - Self::F16 => "16-bit IEEE-754 floating point, also known as `half`.", - Self::F32 => "32-bit IEEE-754 floating point, also known as `float` or `single`.", - Self::F64 => "64-bit IEEE-754 floating point, also known as `double`.", - } - } -} - -impl ::re_types_core::SizeBytes for ChannelDatatype { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for ChannelDatatype { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::U8 => write!(f, "U8"), - Self::I8 => write!(f, "I8"), - Self::U16 => write!(f, "U16"), - Self::I16 => write!(f, "I16"), - Self::U32 => write!(f, "U32"), - Self::I32 => write!(f, "I32"), - Self::U64 => write!(f, "U64"), - Self::I64 => write!(f, "I64"), - Self::F16 => write!(f, "F16"), - Self::F32 => write!(f, "F32"), - Self::F64 => write!(f, "F64"), - } - } -} - ::re_types_core::macros::impl_into_cow!(ChannelDatatype); impl ::re_types_core::Loggable for ChannelDatatype { @@ -220,3 +154,69 @@ impl ::re_types_core::Loggable for ChannelDatatype { .with_context("rerun.datatypes.ChannelDatatype")?) } } + +impl std::fmt::Display for ChannelDatatype { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::U8 => write!(f, "U8"), + Self::I8 => write!(f, "I8"), + Self::U16 => write!(f, "U16"), + Self::I16 => write!(f, "I16"), + Self::U32 => write!(f, "U32"), + Self::I32 => write!(f, "I32"), + Self::U64 => write!(f, "U64"), + Self::I64 => write!(f, "I64"), + Self::F16 => write!(f, "F16"), + Self::F32 => write!(f, "F32"), + Self::F64 => write!(f, "F64"), + } + } +} + +impl ::re_types_core::reflection::Enum for ChannelDatatype { + #[inline] + fn variants() -> &'static [Self] { + &[ + Self::U8, + Self::I8, + Self::U16, + Self::I16, + Self::U32, + Self::I32, + Self::U64, + Self::I64, + Self::F16, + Self::F32, + Self::F64, + ] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::U8 => "8-bit unsigned integer.", + Self::I8 => "8-bit signed integer.", + Self::U16 => "16-bit unsigned integer.", + Self::I16 => "16-bit signed integer.", + Self::U32 => "32-bit unsigned integer.", + Self::I32 => "32-bit signed integer.", + Self::U64 => "64-bit unsigned integer.", + Self::I64 => "64-bit signed integer.", + Self::F16 => "16-bit IEEE-754 floating point, also known as `half`.", + Self::F32 => "32-bit IEEE-754 floating point, also known as `float` or `single`.", + Self::F64 => "64-bit IEEE-754 floating point, also known as `double`.", + } + } +} + +impl ::re_types_core::SizeBytes for ChannelDatatype { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true + } +} diff --git a/crates/store/re_types/src/datatypes/class_description.rs b/crates/store/re_types/src/datatypes/class_description.rs index 0bc823d1b5b9a..ae7c516686946 100644 --- a/crates/store/re_types/src/datatypes/class_description.rs +++ b/crates/store/re_types/src/datatypes/class_description.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: The description of a semantic Class. @@ -44,22 +44,6 @@ pub struct ClassDescription { pub keypoint_connections: Vec, } -impl ::re_types_core::SizeBytes for ClassDescription { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.info.heap_size_bytes() - + self.keypoint_annotations.heap_size_bytes() - + self.keypoint_connections.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && >::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(ClassDescription); impl ::re_types_core::Loggable for ClassDescription { @@ -475,3 +459,19 @@ impl ::re_types_core::Loggable for ClassDescription { }) } } + +impl ::re_types_core::SizeBytes for ClassDescription { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.info.heap_size_bytes() + + self.keypoint_annotations.heap_size_bytes() + + self.keypoint_connections.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/class_description_map_elem.rs b/crates/store/re_types/src/datatypes/class_description_map_elem.rs index fabdbe23187fa..c7f52507b4e02 100644 --- a/crates/store/re_types/src/datatypes/class_description_map_elem.rs +++ b/crates/store/re_types/src/datatypes/class_description_map_elem.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A helper type for mapping [`datatypes::ClassId`][crate::datatypes::ClassId]s to class descriptions. @@ -30,18 +30,6 @@ pub struct ClassDescriptionMapElem { pub class_description: crate::datatypes::ClassDescription, } -impl ::re_types_core::SizeBytes for ClassDescriptionMapElem { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.class_id.heap_size_bytes() + self.class_description.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(ClassDescriptionMapElem); impl ::re_types_core::Loggable for ClassDescriptionMapElem { @@ -241,3 +229,15 @@ impl ::re_types_core::Loggable for ClassDescriptionMapElem { }) } } + +impl ::re_types_core::SizeBytes for ClassDescriptionMapElem { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.class_id.heap_size_bytes() + self.class_description.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/class_id.rs b/crates/store/re_types/src/datatypes/class_id.rs index f96ec8c230764..f715fbdc0f8d0 100644 --- a/crates/store/re_types/src/datatypes/class_id.rs +++ b/crates/store/re_types/src/datatypes/class_id.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A 16-bit ID representing a type of semantic class. @@ -38,32 +38,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct ClassId(pub u16); -impl ::re_types_core::SizeBytes for ClassId { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for ClassId { - #[inline] - fn from(id: u16) -> Self { - Self(id) - } -} - -impl From for u16 { - #[inline] - fn from(value: ClassId) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(ClassId); impl ::re_types_core::Loggable for ClassId { @@ -174,3 +148,29 @@ impl ::re_types_core::Loggable for ClassId { }) } } + +impl From for ClassId { + #[inline] + fn from(id: u16) -> Self { + Self(id) + } +} + +impl From for u16 { + #[inline] + fn from(value: ClassId) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for ClassId { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/color_model.rs b/crates/store/re_types/src/datatypes/color_model.rs index bbb4ab094b6c5..594dab3080f82 100644 --- a/crates/store/re_types/src/datatypes/color_model.rs +++ b/crates/store/re_types/src/datatypes/color_model.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Specified what color components are present in an [`archetypes::Image`][crate::archetypes::Image]. @@ -46,48 +46,6 @@ pub enum ColorModel { BGRA = 5, } -impl ::re_types_core::reflection::Enum for ColorModel { - #[inline] - fn variants() -> &'static [Self] { - &[Self::L, Self::RGB, Self::RGBA, Self::BGR, Self::BGRA] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::L => "Grayscale luminance intencity/brightness/value, sometimes called `Y`", - Self::RGB => "Red, Green, Blue", - Self::RGBA => "Red, Green, Blue, Alpha", - Self::BGR => "Blue, Green, Red", - Self::BGRA => "Blue, Green, Red, Alpha", - } - } -} - -impl ::re_types_core::SizeBytes for ColorModel { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for ColorModel { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::L => write!(f, "L"), - Self::RGB => write!(f, "RGB"), - Self::RGBA => write!(f, "RGBA"), - Self::BGR => write!(f, "BGR"), - Self::BGRA => write!(f, "BGRA"), - } - } -} - ::re_types_core::macros::impl_into_cow!(ColorModel); impl ::re_types_core::Loggable for ColorModel { @@ -176,3 +134,45 @@ impl ::re_types_core::Loggable for ColorModel { .with_context("rerun.datatypes.ColorModel")?) } } + +impl std::fmt::Display for ColorModel { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::L => write!(f, "L"), + Self::RGB => write!(f, "RGB"), + Self::RGBA => write!(f, "RGBA"), + Self::BGR => write!(f, "BGR"), + Self::BGRA => write!(f, "BGRA"), + } + } +} + +impl ::re_types_core::reflection::Enum for ColorModel { + #[inline] + fn variants() -> &'static [Self] { + &[Self::L, Self::RGB, Self::RGBA, Self::BGR, Self::BGRA] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::L => "Grayscale luminance intencity/brightness/value, sometimes called `Y`", + Self::RGB => "Red, Green, Blue", + Self::RGBA => "Red, Green, Blue, Alpha", + Self::BGR => "Blue, Green, Red", + Self::BGRA => "Blue, Green, Red, Alpha", + } + } +} + +impl ::re_types_core::SizeBytes for ColorModel { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true + } +} diff --git a/crates/store/re_types/src/datatypes/dvec2d.rs b/crates/store/re_types/src/datatypes/dvec2d.rs index 98af2bc51c978..f6bd7a3b70849 100644 --- a/crates/store/re_types/src/datatypes/dvec2d.rs +++ b/crates/store/re_types/src/datatypes/dvec2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A double-precision vector in 2D space. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct DVec2D(pub [f64; 2usize]); -impl ::re_types_core::SizeBytes for DVec2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[f64; 2usize]>::is_pod() - } -} - -impl From<[f64; 2usize]> for DVec2D { - #[inline] - fn from(xy: [f64; 2usize]) -> Self { - Self(xy) - } -} - -impl From for [f64; 2usize] { - #[inline] - fn from(value: DVec2D) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(DVec2D); impl ::re_types_core::Loggable for DVec2D { @@ -247,3 +221,29 @@ impl ::re_types_core::Loggable for DVec2D { }) } } + +impl From<[f64; 2usize]> for DVec2D { + #[inline] + fn from(xy: [f64; 2usize]) -> Self { + Self(xy) + } +} + +impl From for [f64; 2usize] { + #[inline] + fn from(value: DVec2D) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for DVec2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[f64; 2usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/image_format.rs b/crates/store/re_types/src/datatypes/image_format.rs index 4980d67bde5bb..d1b7cf46130fa 100644 --- a/crates/store/re_types/src/datatypes/image_format.rs +++ b/crates/store/re_types/src/datatypes/image_format.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: The metadata describing the contents of a [`components::ImageBuffer`][crate::components::ImageBuffer]. @@ -43,26 +43,6 @@ pub struct ImageFormat { pub channel_datatype: Option, } -impl ::re_types_core::SizeBytes for ImageFormat { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.width.heap_size_bytes() - + self.height.heap_size_bytes() - + self.pixel_format.heap_size_bytes() - + self.color_model.heap_size_bytes() - + self.channel_datatype.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(ImageFormat); impl ::re_types_core::Loggable for ImageFormat { @@ -389,3 +369,23 @@ impl ::re_types_core::Loggable for ImageFormat { }) } } + +impl ::re_types_core::SizeBytes for ImageFormat { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.width.heap_size_bytes() + + self.height.heap_size_bytes() + + self.pixel_format.heap_size_bytes() + + self.color_model.heap_size_bytes() + + self.channel_datatype.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && ::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/keypoint_id.rs b/crates/store/re_types/src/datatypes/keypoint_id.rs index d01fe3439c7e4..4af3c67b091b2 100644 --- a/crates/store/re_types/src/datatypes/keypoint_id.rs +++ b/crates/store/re_types/src/datatypes/keypoint_id.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A 16-bit ID representing a type of semantic keypoint within a class. @@ -40,32 +40,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct KeypointId(pub u16); -impl ::re_types_core::SizeBytes for KeypointId { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for KeypointId { - #[inline] - fn from(id: u16) -> Self { - Self(id) - } -} - -impl From for u16 { - #[inline] - fn from(value: KeypointId) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(KeypointId); impl ::re_types_core::Loggable for KeypointId { @@ -176,3 +150,29 @@ impl ::re_types_core::Loggable for KeypointId { }) } } + +impl From for KeypointId { + #[inline] + fn from(id: u16) -> Self { + Self(id) + } +} + +impl From for u16 { + #[inline] + fn from(value: KeypointId) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for KeypointId { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/keypoint_pair.rs b/crates/store/re_types/src/datatypes/keypoint_pair.rs index ed172c617203f..e34db74278fa7 100644 --- a/crates/store/re_types/src/datatypes/keypoint_pair.rs +++ b/crates/store/re_types/src/datatypes/keypoint_pair.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A connection between two [`datatypes::KeypointId`][crate::datatypes::KeypointId]s. @@ -28,18 +28,6 @@ pub struct KeypointPair { pub keypoint1: crate::datatypes::KeypointId, } -impl ::re_types_core::SizeBytes for KeypointPair { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.keypoint0.heap_size_bytes() + self.keypoint1.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(KeypointPair); impl ::re_types_core::Loggable for KeypointPair { @@ -250,3 +238,15 @@ impl ::re_types_core::Loggable for KeypointPair { }) } } + +impl ::re_types_core::SizeBytes for KeypointPair { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.keypoint0.heap_size_bytes() + self.keypoint1.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/mat3x3.rs b/crates/store/re_types/src/datatypes/mat3x3.rs index 9a5c33b32af36..4318716dc0fea 100644 --- a/crates/store/re_types/src/datatypes/mat3x3.rs +++ b/crates/store/re_types/src/datatypes/mat3x3.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A 3x3 Matrix. @@ -35,32 +35,6 @@ pub struct Mat3x3( pub [f32; 9usize], ); -impl ::re_types_core::SizeBytes for Mat3x3 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[f32; 9usize]>::is_pod() - } -} - -impl From<[f32; 9usize]> for Mat3x3 { - #[inline] - fn from(flat_columns: [f32; 9usize]) -> Self { - Self(flat_columns) - } -} - -impl From for [f32; 9usize] { - #[inline] - fn from(value: Mat3x3) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Mat3x3); impl ::re_types_core::Loggable for Mat3x3 { @@ -259,3 +233,29 @@ impl ::re_types_core::Loggable for Mat3x3 { }) } } + +impl From<[f32; 9usize]> for Mat3x3 { + #[inline] + fn from(flat_columns: [f32; 9usize]) -> Self { + Self(flat_columns) + } +} + +impl From for [f32; 9usize] { + #[inline] + fn from(value: Mat3x3) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Mat3x3 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[f32; 9usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/mat4x4.rs b/crates/store/re_types/src/datatypes/mat4x4.rs index e877dbc87c1d4..3346302600790 100644 --- a/crates/store/re_types/src/datatypes/mat4x4.rs +++ b/crates/store/re_types/src/datatypes/mat4x4.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A 4x4 Matrix. @@ -35,32 +35,6 @@ pub struct Mat4x4( pub [f32; 16usize], ); -impl ::re_types_core::SizeBytes for Mat4x4 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[f32; 16usize]>::is_pod() - } -} - -impl From<[f32; 16usize]> for Mat4x4 { - #[inline] - fn from(flat_columns: [f32; 16usize]) -> Self { - Self(flat_columns) - } -} - -impl From for [f32; 16usize] { - #[inline] - fn from(value: Mat4x4) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Mat4x4); impl ::re_types_core::Loggable for Mat4x4 { @@ -259,3 +233,29 @@ impl ::re_types_core::Loggable for Mat4x4 { }) } } + +impl From<[f32; 16usize]> for Mat4x4 { + #[inline] + fn from(flat_columns: [f32; 16usize]) -> Self { + Self(flat_columns) + } +} + +impl From for [f32; 16usize] { + #[inline] + fn from(value: Mat4x4) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Mat4x4 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[f32; 16usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/pixel_format.rs b/crates/store/re_types/src/datatypes/pixel_format.rs index 85b2aa02dc177..d6ae6f2864419 100644 --- a/crates/store/re_types/src/datatypes/pixel_format.rs +++ b/crates/store/re_types/src/datatypes/pixel_format.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Specifieds a particular format of an [`archetypes::Image`][crate::archetypes::Image]. @@ -125,89 +125,6 @@ pub enum PixelFormat { Y_U_V16_FullRange = 50, } -impl ::re_types_core::reflection::Enum for PixelFormat { - #[inline] - fn variants() -> &'static [Self] { - &[ - Self::Y_U_V12_LimitedRange, - Self::NV12, - Self::YUY2, - Self::Y8_FullRange, - Self::Y_U_V24_LimitedRange, - Self::Y_U_V24_FullRange, - Self::Y8_LimitedRange, - Self::Y_U_V12_FullRange, - Self::Y_U_V16_LimitedRange, - Self::Y_U_V16_FullRange, - ] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Y_U_V12_LimitedRange => { - "`Y_U_V12` is a YUV 4:2:0 fully planar YUV format without chroma downsampling, also known as `I420`.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe resolution of the Y plane." - } - Self::NV12 => { - "`NV12` (aka `Y_UV12`) is a YUV 4:2:0 chroma downsampled form at with 12 bits per pixel and 8 bits per channel.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane,\nfollowed by a plane with interleaved lines ordered as U0, V0, U1, V1, etc." - } - Self::YUY2 => { - "`YUY2` (aka `YUYV`, `YUYV16` or `NV21`), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nThe order of the channels is Y0, U0, Y1, V0, all in the same plane." - } - Self::Y8_FullRange => { - "Monochrome Y plane only, essentially a YUV 4:0:0 planar format.\n\nAlso known as just \"gray\". This is virtually identical to a 8bit luminance/grayscale (see [`datatypes::ColorModel`][crate::datatypes::ColorModel]).\n\nThis uses entire range YUV, i.e. Y is expected to be within [0, 255].\n(as opposed to \"limited range\" YUV as used e.g. in NV12)." - } - Self::Y_U_V24_LimitedRange => { - "`Y_U_V24` is a YUV 4:4:4 fully planar YUV format without chroma downsampling, also known as `I444`.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane, followed by the U and V planes." - } - Self::Y_U_V24_FullRange => { - "`Y_U_V24` is a YUV 4:4:4 fully planar YUV format without chroma downsampling, also known as `I444`.\n\nThis uses full range YUV with all components ranging from 0 to 255\n(as opposed to \"limited range\" YUV as used e.g. in NV12).\n\nFirst comes entire image in Y in one plane, followed by the U and V planes." - } - Self::Y8_LimitedRange => { - "Monochrome Y plane only, essentially a YUV 4:0:0 planar format.\n\nAlso known as just \"gray\".\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235].\nIf not for this range limitation/remapping, this is almost identical to 8bit luminace/grayscale (see [`datatypes::ColorModel`][crate::datatypes::ColorModel])." - } - Self::Y_U_V12_FullRange => { - "`Y_U_V12` is a YUV 4:2:0 fully planar YUV format without chroma downsampling, also known as `I420`.\n\nThis uses full range YUV with all components ranging from 0 to 255\n(as opposed to \"limited range\" YUV as used e.g. in NV12).\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe resolution of the Y plane." - } - Self::Y_U_V16_LimitedRange => { - "`Y_U_V16` is a YUV 4:2:2 fully planar YUV format without chroma downsampling, also known as `I422`.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe horizontal resolution of the Y plane." - } - Self::Y_U_V16_FullRange => { - "`Y_U_V16` is a YUV 4:2:2 fully planar YUV format without chroma downsampling, also known as `I422`.\n\nThis uses full range YUV with all components ranging from 0 to 255\n(as opposed to \"limited range\" YUV as used e.g. in NV12).\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe horizontal resolution of the Y plane." - } - } - } -} - -impl ::re_types_core::SizeBytes for PixelFormat { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for PixelFormat { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Y_U_V12_LimitedRange => write!(f, "Y_U_V12_LimitedRange"), - Self::NV12 => write!(f, "NV12"), - Self::YUY2 => write!(f, "YUY2"), - Self::Y8_FullRange => write!(f, "Y8_FullRange"), - Self::Y_U_V24_LimitedRange => write!(f, "Y_U_V24_LimitedRange"), - Self::Y_U_V24_FullRange => write!(f, "Y_U_V24_FullRange"), - Self::Y8_LimitedRange => write!(f, "Y8_LimitedRange"), - Self::Y_U_V12_FullRange => write!(f, "Y_U_V12_FullRange"), - Self::Y_U_V16_LimitedRange => write!(f, "Y_U_V16_LimitedRange"), - Self::Y_U_V16_FullRange => write!(f, "Y_U_V16_FullRange"), - } - } -} - ::re_types_core::macros::impl_into_cow!(PixelFormat); impl ::re_types_core::Loggable for PixelFormat { @@ -301,3 +218,86 @@ impl ::re_types_core::Loggable for PixelFormat { .with_context("rerun.datatypes.PixelFormat")?) } } + +impl std::fmt::Display for PixelFormat { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Y_U_V12_LimitedRange => write!(f, "Y_U_V12_LimitedRange"), + Self::NV12 => write!(f, "NV12"), + Self::YUY2 => write!(f, "YUY2"), + Self::Y8_FullRange => write!(f, "Y8_FullRange"), + Self::Y_U_V24_LimitedRange => write!(f, "Y_U_V24_LimitedRange"), + Self::Y_U_V24_FullRange => write!(f, "Y_U_V24_FullRange"), + Self::Y8_LimitedRange => write!(f, "Y8_LimitedRange"), + Self::Y_U_V12_FullRange => write!(f, "Y_U_V12_FullRange"), + Self::Y_U_V16_LimitedRange => write!(f, "Y_U_V16_LimitedRange"), + Self::Y_U_V16_FullRange => write!(f, "Y_U_V16_FullRange"), + } + } +} + +impl ::re_types_core::reflection::Enum for PixelFormat { + #[inline] + fn variants() -> &'static [Self] { + &[ + Self::Y_U_V12_LimitedRange, + Self::NV12, + Self::YUY2, + Self::Y8_FullRange, + Self::Y_U_V24_LimitedRange, + Self::Y_U_V24_FullRange, + Self::Y8_LimitedRange, + Self::Y_U_V12_FullRange, + Self::Y_U_V16_LimitedRange, + Self::Y_U_V16_FullRange, + ] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::Y_U_V12_LimitedRange => { + "`Y_U_V12` is a YUV 4:2:0 fully planar YUV format without chroma downsampling, also known as `I420`.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe resolution of the Y plane." + } + Self::NV12 => { + "`NV12` (aka `Y_UV12`) is a YUV 4:2:0 chroma downsampled form at with 12 bits per pixel and 8 bits per channel.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane,\nfollowed by a plane with interleaved lines ordered as U0, V0, U1, V1, etc." + } + Self::YUY2 => { + "`YUY2` (aka `YUYV`, `YUYV16` or `NV21`), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nThe order of the channels is Y0, U0, Y1, V0, all in the same plane." + } + Self::Y8_FullRange => { + "Monochrome Y plane only, essentially a YUV 4:0:0 planar format.\n\nAlso known as just \"gray\". This is virtually identical to a 8bit luminance/grayscale (see [`datatypes::ColorModel`][crate::datatypes::ColorModel]).\n\nThis uses entire range YUV, i.e. Y is expected to be within [0, 255].\n(as opposed to \"limited range\" YUV as used e.g. in NV12)." + } + Self::Y_U_V24_LimitedRange => { + "`Y_U_V24` is a YUV 4:4:4 fully planar YUV format without chroma downsampling, also known as `I444`.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane, followed by the U and V planes." + } + Self::Y_U_V24_FullRange => { + "`Y_U_V24` is a YUV 4:4:4 fully planar YUV format without chroma downsampling, also known as `I444`.\n\nThis uses full range YUV with all components ranging from 0 to 255\n(as opposed to \"limited range\" YUV as used e.g. in NV12).\n\nFirst comes entire image in Y in one plane, followed by the U and V planes." + } + Self::Y8_LimitedRange => { + "Monochrome Y plane only, essentially a YUV 4:0:0 planar format.\n\nAlso known as just \"gray\".\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235].\nIf not for this range limitation/remapping, this is almost identical to 8bit luminace/grayscale (see [`datatypes::ColorModel`][crate::datatypes::ColorModel])." + } + Self::Y_U_V12_FullRange => { + "`Y_U_V12` is a YUV 4:2:0 fully planar YUV format without chroma downsampling, also known as `I420`.\n\nThis uses full range YUV with all components ranging from 0 to 255\n(as opposed to \"limited range\" YUV as used e.g. in NV12).\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe resolution of the Y plane." + } + Self::Y_U_V16_LimitedRange => { + "`Y_U_V16` is a YUV 4:2:2 fully planar YUV format without chroma downsampling, also known as `I422`.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe horizontal resolution of the Y plane." + } + Self::Y_U_V16_FullRange => { + "`Y_U_V16` is a YUV 4:2:2 fully planar YUV format without chroma downsampling, also known as `I422`.\n\nThis uses full range YUV with all components ranging from 0 to 255\n(as opposed to \"limited range\" YUV as used e.g. in NV12).\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe horizontal resolution of the Y plane." + } + } + } +} + +impl ::re_types_core::SizeBytes for PixelFormat { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true + } +} diff --git a/crates/store/re_types/src/datatypes/quaternion.rs b/crates/store/re_types/src/datatypes/quaternion.rs index 26a69d7baeca2..382ef5ed8db3f 100644 --- a/crates/store/re_types/src/datatypes/quaternion.rs +++ b/crates/store/re_types/src/datatypes/quaternion.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A Quaternion represented by 4 real numbers. @@ -26,32 +26,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct Quaternion(pub [f32; 4usize]); -impl ::re_types_core::SizeBytes for Quaternion { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[f32; 4usize]>::is_pod() - } -} - -impl From<[f32; 4usize]> for Quaternion { - #[inline] - fn from(xyzw: [f32; 4usize]) -> Self { - Self(xyzw) - } -} - -impl From for [f32; 4usize] { - #[inline] - fn from(value: Quaternion) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Quaternion); impl ::re_types_core::Loggable for Quaternion { @@ -250,3 +224,29 @@ impl ::re_types_core::Loggable for Quaternion { }) } } + +impl From<[f32; 4usize]> for Quaternion { + #[inline] + fn from(xyzw: [f32; 4usize]) -> Self { + Self(xyzw) + } +} + +impl From for [f32; 4usize] { + #[inline] + fn from(value: Quaternion) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Quaternion { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[f32; 4usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/range1d.rs b/crates/store/re_types/src/datatypes/range1d.rs index e003c5ab2f041..7e0b679e6b65a 100644 --- a/crates/store/re_types/src/datatypes/range1d.rs +++ b/crates/store/re_types/src/datatypes/range1d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A 1D range, specifying a lower and upper bound. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct Range1D(pub [f64; 2usize]); -impl ::re_types_core::SizeBytes for Range1D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[f64; 2usize]>::is_pod() - } -} - -impl From<[f64; 2usize]> for Range1D { - #[inline] - fn from(range: [f64; 2usize]) -> Self { - Self(range) - } -} - -impl From for [f64; 2usize] { - #[inline] - fn from(value: Range1D) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Range1D); impl ::re_types_core::Loggable for Range1D { @@ -247,3 +221,29 @@ impl ::re_types_core::Loggable for Range1D { }) } } + +impl From<[f64; 2usize]> for Range1D { + #[inline] + fn from(range: [f64; 2usize]) -> Self { + Self(range) + } +} + +impl From for [f64; 2usize] { + #[inline] + fn from(value: Range1D) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Range1D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[f64; 2usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/range2d.rs b/crates/store/re_types/src/datatypes/range2d.rs index 201b3406d2806..bce8ba0f11650 100644 --- a/crates/store/re_types/src/datatypes/range2d.rs +++ b/crates/store/re_types/src/datatypes/range2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: An Axis-Aligned Bounding Box in 2D space, implemented as the minimum and maximum corners. @@ -29,18 +29,6 @@ pub struct Range2D { pub y_range: crate::datatypes::Range1D, } -impl ::re_types_core::SizeBytes for Range2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.x_range.heap_size_bytes() + self.y_range.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(Range2D); impl ::re_types_core::Loggable for Range2D { @@ -405,3 +393,15 @@ impl ::re_types_core::Loggable for Range2D { }) } } + +impl ::re_types_core::SizeBytes for Range2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.x_range.heap_size_bytes() + self.y_range.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/rgba32.rs b/crates/store/re_types/src/datatypes/rgba32.rs index af704b5aa2f15..d5a0f78a44e2f 100644 --- a/crates/store/re_types/src/datatypes/rgba32.rs +++ b/crates/store/re_types/src/datatypes/rgba32.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. @@ -28,32 +28,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Rgba32(pub u32); -impl ::re_types_core::SizeBytes for Rgba32 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for Rgba32 { - #[inline] - fn from(rgba: u32) -> Self { - Self(rgba) - } -} - -impl From for u32 { - #[inline] - fn from(value: Rgba32) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Rgba32); impl ::re_types_core::Loggable for Rgba32 { @@ -164,3 +138,29 @@ impl ::re_types_core::Loggable for Rgba32 { }) } } + +impl From for Rgba32 { + #[inline] + fn from(rgba: u32) -> Self { + Self(rgba) + } +} + +impl From for u32 { + #[inline] + fn from(value: Rgba32) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Rgba32 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/rotation_axis_angle.rs b/crates/store/re_types/src/datatypes/rotation_axis_angle.rs index 403af5cb9dce6..3383ff8b47adb 100644 --- a/crates/store/re_types/src/datatypes/rotation_axis_angle.rs +++ b/crates/store/re_types/src/datatypes/rotation_axis_angle.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: 3D rotation represented by a rotation around a given axis. @@ -32,18 +32,6 @@ pub struct RotationAxisAngle { pub angle: crate::datatypes::Angle, } -impl ::re_types_core::SizeBytes for RotationAxisAngle { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.axis.heap_size_bytes() + self.angle.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(RotationAxisAngle); impl ::re_types_core::Loggable for RotationAxisAngle { @@ -318,3 +306,15 @@ impl ::re_types_core::Loggable for RotationAxisAngle { }) } } + +impl ::re_types_core::SizeBytes for RotationAxisAngle { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.axis.heap_size_bytes() + self.angle.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/tensor_buffer.rs b/crates/store/re_types/src/datatypes/tensor_buffer.rs index d95b11b68421b..9a146663b6f0f 100644 --- a/crates/store/re_types/src/datatypes/tensor_buffer.rs +++ b/crates/store/re_types/src/datatypes/tensor_buffer.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: The underlying storage for [`archetypes::Tensor`][crate::archetypes::Tensor]. @@ -57,41 +57,6 @@ pub enum TensorBuffer { F64(::re_types_core::ArrowBuffer), } -impl ::re_types_core::SizeBytes for TensorBuffer { - #[inline] - fn heap_size_bytes(&self) -> u64 { - #![allow(clippy::match_same_arms)] - match self { - Self::U8(v) => v.heap_size_bytes(), - Self::U16(v) => v.heap_size_bytes(), - Self::U32(v) => v.heap_size_bytes(), - Self::U64(v) => v.heap_size_bytes(), - Self::I8(v) => v.heap_size_bytes(), - Self::I16(v) => v.heap_size_bytes(), - Self::I32(v) => v.heap_size_bytes(), - Self::I64(v) => v.heap_size_bytes(), - Self::F16(v) => v.heap_size_bytes(), - Self::F32(v) => v.heap_size_bytes(), - Self::F64(v) => v.heap_size_bytes(), - } - } - - #[inline] - fn is_pod() -> bool { - <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - && <::re_types_core::ArrowBuffer>::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(TensorBuffer); impl ::re_types_core::Loggable for TensorBuffer { @@ -1764,3 +1729,38 @@ impl ::re_types_core::Loggable for TensorBuffer { }) } } + +impl ::re_types_core::SizeBytes for TensorBuffer { + #[inline] + fn heap_size_bytes(&self) -> u64 { + #![allow(clippy::match_same_arms)] + match self { + Self::U8(v) => v.heap_size_bytes(), + Self::U16(v) => v.heap_size_bytes(), + Self::U32(v) => v.heap_size_bytes(), + Self::U64(v) => v.heap_size_bytes(), + Self::I8(v) => v.heap_size_bytes(), + Self::I16(v) => v.heap_size_bytes(), + Self::I32(v) => v.heap_size_bytes(), + Self::I64(v) => v.heap_size_bytes(), + Self::F16(v) => v.heap_size_bytes(), + Self::F32(v) => v.heap_size_bytes(), + Self::F64(v) => v.heap_size_bytes(), + } + } + + #[inline] + fn is_pod() -> bool { + <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + && <::re_types_core::ArrowBuffer>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/tensor_data.rs b/crates/store/re_types/src/datatypes/tensor_data.rs index 6ab60d8ca0d91..ad238bc490684 100644 --- a/crates/store/re_types/src/datatypes/tensor_data.rs +++ b/crates/store/re_types/src/datatypes/tensor_data.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: An N-dimensional array of numbers. @@ -35,19 +35,6 @@ pub struct TensorData { pub buffer: crate::datatypes::TensorBuffer, } -impl ::re_types_core::SizeBytes for TensorData { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.shape.heap_size_bytes() + self.buffer.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(TensorData); impl ::re_types_core::Loggable for TensorData { @@ -312,3 +299,16 @@ impl ::re_types_core::Loggable for TensorData { }) } } + +impl ::re_types_core::SizeBytes for TensorData { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.shape.heap_size_bytes() + self.buffer.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/tensor_dimension.rs b/crates/store/re_types/src/datatypes/tensor_dimension.rs index d066945ff3593..13e229e803ea9 100644 --- a/crates/store/re_types/src/datatypes/tensor_dimension.rs +++ b/crates/store/re_types/src/datatypes/tensor_dimension.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A single dimension within a multi-dimensional tensor. @@ -28,18 +28,6 @@ pub struct TensorDimension { pub name: Option<::re_types_core::ArrowString>, } -impl ::re_types_core::SizeBytes for TensorDimension { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.size.heap_size_bytes() + self.name.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && >::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(TensorDimension); impl ::re_types_core::Loggable for TensorDimension { @@ -265,3 +253,15 @@ impl ::re_types_core::Loggable for TensorDimension { }) } } + +impl ::re_types_core::SizeBytes for TensorDimension { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.size.heap_size_bytes() + self.name.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && >::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/tensor_dimension_index_selection.rs b/crates/store/re_types/src/datatypes/tensor_dimension_index_selection.rs index 7a85be295e0d5..a318a37eb2b44 100644 --- a/crates/store/re_types/src/datatypes/tensor_dimension_index_selection.rs +++ b/crates/store/re_types/src/datatypes/tensor_dimension_index_selection.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Indexing a specific tensor dimension. @@ -30,18 +30,6 @@ pub struct TensorDimensionIndexSelection { pub index: u64, } -impl ::re_types_core::SizeBytes for TensorDimensionIndexSelection { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.dimension.heap_size_bytes() + self.index.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(TensorDimensionIndexSelection); impl ::re_types_core::Loggable for TensorDimensionIndexSelection { @@ -238,3 +226,15 @@ impl ::re_types_core::Loggable for TensorDimensionIndexSelection { }) } } + +impl ::re_types_core::SizeBytes for TensorDimensionIndexSelection { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.dimension.heap_size_bytes() + self.index.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/tensor_dimension_selection.rs b/crates/store/re_types/src/datatypes/tensor_dimension_selection.rs index 70baf2180964d..bf4c28f5e007a 100644 --- a/crates/store/re_types/src/datatypes/tensor_dimension_selection.rs +++ b/crates/store/re_types/src/datatypes/tensor_dimension_selection.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Selection of a single tensor dimension. @@ -28,18 +28,6 @@ pub struct TensorDimensionSelection { pub invert: bool, } -impl ::re_types_core::SizeBytes for TensorDimensionSelection { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.dimension.heap_size_bytes() + self.invert.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(TensorDimensionSelection); impl ::re_types_core::Loggable for TensorDimensionSelection { @@ -233,3 +221,15 @@ impl ::re_types_core::Loggable for TensorDimensionSelection { }) } } + +impl ::re_types_core::SizeBytes for TensorDimensionSelection { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.dimension.heap_size_bytes() + self.invert.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/utf8pair.rs b/crates/store/re_types/src/datatypes/utf8pair.rs index cc9b292a03288..c614936865683 100644 --- a/crates/store/re_types/src/datatypes/utf8pair.rs +++ b/crates/store/re_types/src/datatypes/utf8pair.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Stores a tuple of UTF-8 strings. @@ -28,18 +28,6 @@ pub struct Utf8Pair { pub second: crate::datatypes::Utf8, } -impl ::re_types_core::SizeBytes for Utf8Pair { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.first.heap_size_bytes() + self.second.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(Utf8Pair); impl ::re_types_core::Loggable for Utf8Pair { @@ -314,3 +302,15 @@ impl ::re_types_core::Loggable for Utf8Pair { }) } } + +impl ::re_types_core::SizeBytes for Utf8Pair { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.first.heap_size_bytes() + self.second.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/uuid.rs b/crates/store/re_types/src/datatypes/uuid.rs index 646c303d9bc50..31b15edb73b26 100644 --- a/crates/store/re_types/src/datatypes/uuid.rs +++ b/crates/store/re_types/src/datatypes/uuid.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A 16-byte UUID. @@ -26,32 +26,6 @@ pub struct Uuid { pub bytes: [u8; 16usize], } -impl ::re_types_core::SizeBytes for Uuid { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.bytes.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[u8; 16usize]>::is_pod() - } -} - -impl From<[u8; 16usize]> for Uuid { - #[inline] - fn from(bytes: [u8; 16usize]) -> Self { - Self { bytes } - } -} - -impl From for [u8; 16usize] { - #[inline] - fn from(value: Uuid) -> Self { - value.bytes - } -} - ::re_types_core::macros::impl_into_cow!(Uuid); impl ::re_types_core::Loggable for Uuid { @@ -254,3 +228,29 @@ impl ::re_types_core::Loggable for Uuid { }) } } + +impl From<[u8; 16usize]> for Uuid { + #[inline] + fn from(bytes: [u8; 16usize]) -> Self { + Self { bytes } + } +} + +impl From for [u8; 16usize] { + #[inline] + fn from(value: Uuid) -> Self { + value.bytes + } +} + +impl ::re_types_core::SizeBytes for Uuid { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.bytes.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[u8; 16usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/uvec2d.rs b/crates/store/re_types/src/datatypes/uvec2d.rs index fb6f3ed5b3542..fa3fa84b88efb 100644 --- a/crates/store/re_types/src/datatypes/uvec2d.rs +++ b/crates/store/re_types/src/datatypes/uvec2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A uint32 vector in 2D space. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct UVec2D(pub [u32; 2usize]); -impl ::re_types_core::SizeBytes for UVec2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[u32; 2usize]>::is_pod() - } -} - -impl From<[u32; 2usize]> for UVec2D { - #[inline] - fn from(xy: [u32; 2usize]) -> Self { - Self(xy) - } -} - -impl From for [u32; 2usize] { - #[inline] - fn from(value: UVec2D) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(UVec2D); impl ::re_types_core::Loggable for UVec2D { @@ -247,3 +221,29 @@ impl ::re_types_core::Loggable for UVec2D { }) } } + +impl From<[u32; 2usize]> for UVec2D { + #[inline] + fn from(xy: [u32; 2usize]) -> Self { + Self(xy) + } +} + +impl From for [u32; 2usize] { + #[inline] + fn from(value: UVec2D) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for UVec2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[u32; 2usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/uvec3d.rs b/crates/store/re_types/src/datatypes/uvec3d.rs index c92cb64ca1af9..87d629e6f9d87 100644 --- a/crates/store/re_types/src/datatypes/uvec3d.rs +++ b/crates/store/re_types/src/datatypes/uvec3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A uint32 vector in 3D space. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct UVec3D(pub [u32; 3usize]); -impl ::re_types_core::SizeBytes for UVec3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[u32; 3usize]>::is_pod() - } -} - -impl From<[u32; 3usize]> for UVec3D { - #[inline] - fn from(xyz: [u32; 3usize]) -> Self { - Self(xyz) - } -} - -impl From for [u32; 3usize] { - #[inline] - fn from(value: UVec3D) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(UVec3D); impl ::re_types_core::Loggable for UVec3D { @@ -247,3 +221,29 @@ impl ::re_types_core::Loggable for UVec3D { }) } } + +impl From<[u32; 3usize]> for UVec3D { + #[inline] + fn from(xyz: [u32; 3usize]) -> Self { + Self(xyz) + } +} + +impl From for [u32; 3usize] { + #[inline] + fn from(value: UVec3D) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for UVec3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[u32; 3usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/uvec4d.rs b/crates/store/re_types/src/datatypes/uvec4d.rs index 32b4b56ac5222..854d66074e6bc 100644 --- a/crates/store/re_types/src/datatypes/uvec4d.rs +++ b/crates/store/re_types/src/datatypes/uvec4d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A uint vector in 4D space. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct UVec4D(pub [u32; 4usize]); -impl ::re_types_core::SizeBytes for UVec4D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[u32; 4usize]>::is_pod() - } -} - -impl From<[u32; 4usize]> for UVec4D { - #[inline] - fn from(xyzw: [u32; 4usize]) -> Self { - Self(xyzw) - } -} - -impl From for [u32; 4usize] { - #[inline] - fn from(value: UVec4D) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(UVec4D); impl ::re_types_core::Loggable for UVec4D { @@ -247,3 +221,29 @@ impl ::re_types_core::Loggable for UVec4D { }) } } + +impl From<[u32; 4usize]> for UVec4D { + #[inline] + fn from(xyzw: [u32; 4usize]) -> Self { + Self(xyzw) + } +} + +impl From for [u32; 4usize] { + #[inline] + fn from(value: UVec4D) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for UVec4D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[u32; 4usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/vec2d.rs b/crates/store/re_types/src/datatypes/vec2d.rs index 6bef61a0eae3d..1fbfa04634f25 100644 --- a/crates/store/re_types/src/datatypes/vec2d.rs +++ b/crates/store/re_types/src/datatypes/vec2d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A vector in 2D space. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct Vec2D(pub [f32; 2usize]); -impl ::re_types_core::SizeBytes for Vec2D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[f32; 2usize]>::is_pod() - } -} - -impl From<[f32; 2usize]> for Vec2D { - #[inline] - fn from(xy: [f32; 2usize]) -> Self { - Self(xy) - } -} - -impl From for [f32; 2usize] { - #[inline] - fn from(value: Vec2D) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Vec2D); impl ::re_types_core::Loggable for Vec2D { @@ -247,3 +221,29 @@ impl ::re_types_core::Loggable for Vec2D { }) } } + +impl From<[f32; 2usize]> for Vec2D { + #[inline] + fn from(xy: [f32; 2usize]) -> Self { + Self(xy) + } +} + +impl From for [f32; 2usize] { + #[inline] + fn from(value: Vec2D) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Vec2D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[f32; 2usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/vec3d.rs b/crates/store/re_types/src/datatypes/vec3d.rs index 9087ef708793c..e85169ac7d2c4 100644 --- a/crates/store/re_types/src/datatypes/vec3d.rs +++ b/crates/store/re_types/src/datatypes/vec3d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A vector in 3D space. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct Vec3D(pub [f32; 3usize]); -impl ::re_types_core::SizeBytes for Vec3D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[f32; 3usize]>::is_pod() - } -} - -impl From<[f32; 3usize]> for Vec3D { - #[inline] - fn from(xyz: [f32; 3usize]) -> Self { - Self(xyz) - } -} - -impl From for [f32; 3usize] { - #[inline] - fn from(value: Vec3D) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Vec3D); impl ::re_types_core::Loggable for Vec3D { @@ -247,3 +221,29 @@ impl ::re_types_core::Loggable for Vec3D { }) } } + +impl From<[f32; 3usize]> for Vec3D { + #[inline] + fn from(xyz: [f32; 3usize]) -> Self { + Self(xyz) + } +} + +impl From for [f32; 3usize] { + #[inline] + fn from(value: Vec3D) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Vec3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[f32; 3usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/vec4d.rs b/crates/store/re_types/src/datatypes/vec4d.rs index b5f1c179985b0..dbad9b6cbdd40 100644 --- a/crates/store/re_types/src/datatypes/vec4d.rs +++ b/crates/store/re_types/src/datatypes/vec4d.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A vector in 4D space. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(C)] pub struct Vec4D(pub [f32; 4usize]); -impl ::re_types_core::SizeBytes for Vec4D { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[f32; 4usize]>::is_pod() - } -} - -impl From<[f32; 4usize]> for Vec4D { - #[inline] - fn from(xyzw: [f32; 4usize]) -> Self { - Self(xyzw) - } -} - -impl From for [f32; 4usize] { - #[inline] - fn from(value: Vec4D) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Vec4D); impl ::re_types_core::Loggable for Vec4D { @@ -247,3 +221,29 @@ impl ::re_types_core::Loggable for Vec4D { }) } } + +impl From<[f32; 4usize]> for Vec4D { + #[inline] + fn from(xyzw: [f32; 4usize]) -> Self { + Self(xyzw) + } +} + +impl From for [f32; 4usize] { + #[inline] + fn from(value: Vec4D) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Vec4D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[f32; 4usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/video_timestamp.rs b/crates/store/re_types/src/datatypes/video_timestamp.rs index 8f690dae7f960..0d64782747728 100644 --- a/crates/store/re_types/src/datatypes/video_timestamp.rs +++ b/crates/store/re_types/src/datatypes/video_timestamp.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: Presentation timestamp within a [`archetypes::AssetVideo`][crate::archetypes::AssetVideo]. @@ -28,32 +28,6 @@ pub struct VideoTimestamp( pub i64, ); -impl ::re_types_core::SizeBytes for VideoTimestamp { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for VideoTimestamp { - #[inline] - fn from(timestamp_ns: i64) -> Self { - Self(timestamp_ns) - } -} - -impl From for i64 { - #[inline] - fn from(value: VideoTimestamp) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(VideoTimestamp); impl ::re_types_core::Loggable for VideoTimestamp { @@ -164,3 +138,29 @@ impl ::re_types_core::Loggable for VideoTimestamp { }) } } + +impl From for VideoTimestamp { + #[inline] + fn from(timestamp_ns: i64) -> Self { + Self(timestamp_ns) + } +} + +impl From for i64 { + #[inline] + fn from(value: VideoTimestamp) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for VideoTimestamp { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/datatypes/view_coordinates.rs b/crates/store/re_types/src/datatypes/view_coordinates.rs index 7294717aa3067..cafb181b01cca 100644 --- a/crates/store/re_types/src/datatypes/view_coordinates.rs +++ b/crates/store/re_types/src/datatypes/view_coordinates.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: How we interpret the coordinate system of an entity/space. @@ -43,32 +43,6 @@ pub struct ViewCoordinates( pub [u8; 3usize], ); -impl ::re_types_core::SizeBytes for ViewCoordinates { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[u8; 3usize]>::is_pod() - } -} - -impl From<[u8; 3usize]> for ViewCoordinates { - #[inline] - fn from(coordinates: [u8; 3usize]) -> Self { - Self(coordinates) - } -} - -impl From for [u8; 3usize] { - #[inline] - fn from(value: ViewCoordinates) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(ViewCoordinates); impl ::re_types_core::Loggable for ViewCoordinates { @@ -267,3 +241,29 @@ impl ::re_types_core::Loggable for ViewCoordinates { }) } } + +impl From<[u8; 3usize]> for ViewCoordinates { + #[inline] + fn from(coordinates: [u8; 3usize]) -> Self { + Self(coordinates) + } +} + +impl From for [u8; 3usize] { + #[inline] + fn from(value: ViewCoordinates) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for ViewCoordinates { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[u8; 3usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs b/crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs index 9c6170f083042..c0dc8d03a8336 100644 --- a/crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs +++ b/crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, PartialEq)] @@ -44,120 +44,252 @@ pub struct AffixFuzzer1 { pub fuzz1022: crate::testing::components::AffixFuzzer22, } -impl ::re_types_core::SizeBytes for AffixFuzzer1 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.fuzz1001.heap_size_bytes() - + self.fuzz1002.heap_size_bytes() - + self.fuzz1003.heap_size_bytes() - + self.fuzz1004.heap_size_bytes() - + self.fuzz1005.heap_size_bytes() - + self.fuzz1006.heap_size_bytes() - + self.fuzz1007.heap_size_bytes() - + self.fuzz1008.heap_size_bytes() - + self.fuzz1009.heap_size_bytes() - + self.fuzz1010.heap_size_bytes() - + self.fuzz1011.heap_size_bytes() - + self.fuzz1012.heap_size_bytes() - + self.fuzz1013.heap_size_bytes() - + self.fuzz1014.heap_size_bytes() - + self.fuzz1015.heap_size_bytes() - + self.fuzz1016.heap_size_bytes() - + self.fuzz1017.heap_size_bytes() - + self.fuzz1018.heap_size_bytes() - + self.fuzz1019.heap_size_bytes() - + self.fuzz1020.heap_size_bytes() - + self.fuzz1021.heap_size_bytes() - + self.fuzz1022.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 22usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 22usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.testing.components.AffixFuzzer1".into(), - "rerun.testing.components.AffixFuzzer2".into(), - "rerun.testing.components.AffixFuzzer3".into(), - "rerun.testing.components.AffixFuzzer4".into(), - "rerun.testing.components.AffixFuzzer5".into(), - "rerun.testing.components.AffixFuzzer6".into(), - "rerun.testing.components.AffixFuzzer7".into(), - "rerun.testing.components.AffixFuzzer8".into(), - "rerun.testing.components.AffixFuzzer9".into(), - "rerun.testing.components.AffixFuzzer10".into(), - "rerun.testing.components.AffixFuzzer11".into(), - "rerun.testing.components.AffixFuzzer12".into(), - "rerun.testing.components.AffixFuzzer13".into(), - "rerun.testing.components.AffixFuzzer14".into(), - "rerun.testing.components.AffixFuzzer15".into(), - "rerun.testing.components.AffixFuzzer16".into(), - "rerun.testing.components.AffixFuzzer17".into(), - "rerun.testing.components.AffixFuzzer18".into(), - "rerun.testing.components.AffixFuzzer19".into(), - "rerun.testing.components.AffixFuzzer20".into(), - "rerun.testing.components.AffixFuzzer21".into(), - "rerun.testing.components.AffixFuzzer22".into(), + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer1".into(), + archetype_field_name: Some("fuzz1001".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer2".into(), + archetype_field_name: Some("fuzz1002".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer3".into(), + archetype_field_name: Some("fuzz1003".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer4".into(), + archetype_field_name: Some("fuzz1004".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer5".into(), + archetype_field_name: Some("fuzz1005".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer6".into(), + archetype_field_name: Some("fuzz1006".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer7".into(), + archetype_field_name: Some("fuzz1007".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer8".into(), + archetype_field_name: Some("fuzz1008".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer9".into(), + archetype_field_name: Some("fuzz1009".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer10".into(), + archetype_field_name: Some("fuzz1010".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer11".into(), + archetype_field_name: Some("fuzz1011".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer12".into(), + archetype_field_name: Some("fuzz1012".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer13".into(), + archetype_field_name: Some("fuzz1013".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer14".into(), + archetype_field_name: Some("fuzz1014".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer15".into(), + archetype_field_name: Some("fuzz1015".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer16".into(), + archetype_field_name: Some("fuzz1016".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer17".into(), + archetype_field_name: Some("fuzz1017".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer18".into(), + archetype_field_name: Some("fuzz1018".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer19".into(), + archetype_field_name: Some("fuzz1019".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer20".into(), + archetype_field_name: Some("fuzz1020".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer21".into(), + archetype_field_name: Some("fuzz1021".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer22".into(), + archetype_field_name: Some("fuzz1022".into()), + }, ] }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.testing.components.AffixFuzzer1Indicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "AffixFuzzer1Indicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 23usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 23usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.testing.components.AffixFuzzer1".into(), - "rerun.testing.components.AffixFuzzer2".into(), - "rerun.testing.components.AffixFuzzer3".into(), - "rerun.testing.components.AffixFuzzer4".into(), - "rerun.testing.components.AffixFuzzer5".into(), - "rerun.testing.components.AffixFuzzer6".into(), - "rerun.testing.components.AffixFuzzer7".into(), - "rerun.testing.components.AffixFuzzer8".into(), - "rerun.testing.components.AffixFuzzer9".into(), - "rerun.testing.components.AffixFuzzer10".into(), - "rerun.testing.components.AffixFuzzer11".into(), - "rerun.testing.components.AffixFuzzer12".into(), - "rerun.testing.components.AffixFuzzer13".into(), - "rerun.testing.components.AffixFuzzer14".into(), - "rerun.testing.components.AffixFuzzer15".into(), - "rerun.testing.components.AffixFuzzer16".into(), - "rerun.testing.components.AffixFuzzer17".into(), - "rerun.testing.components.AffixFuzzer18".into(), - "rerun.testing.components.AffixFuzzer19".into(), - "rerun.testing.components.AffixFuzzer20".into(), - "rerun.testing.components.AffixFuzzer21".into(), - "rerun.testing.components.AffixFuzzer22".into(), - "rerun.testing.components.AffixFuzzer1Indicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer1".into(), + archetype_field_name: Some("fuzz1001".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer2".into(), + archetype_field_name: Some("fuzz1002".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer3".into(), + archetype_field_name: Some("fuzz1003".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer4".into(), + archetype_field_name: Some("fuzz1004".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer5".into(), + archetype_field_name: Some("fuzz1005".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer6".into(), + archetype_field_name: Some("fuzz1006".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer7".into(), + archetype_field_name: Some("fuzz1007".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer8".into(), + archetype_field_name: Some("fuzz1008".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer9".into(), + archetype_field_name: Some("fuzz1009".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer10".into(), + archetype_field_name: Some("fuzz1010".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer11".into(), + archetype_field_name: Some("fuzz1011".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer12".into(), + archetype_field_name: Some("fuzz1012".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer13".into(), + archetype_field_name: Some("fuzz1013".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer14".into(), + archetype_field_name: Some("fuzz1014".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer15".into(), + archetype_field_name: Some("fuzz1015".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer16".into(), + archetype_field_name: Some("fuzz1016".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer17".into(), + archetype_field_name: Some("fuzz1017".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer18".into(), + archetype_field_name: Some("fuzz1018".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer19".into(), + archetype_field_name: Some("fuzz1019".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer20".into(), + archetype_field_name: Some("fuzz1020".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer21".into(), + archetype_field_name: Some("fuzz1021".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "rerun.testing.components.AffixFuzzer22".into(), + archetype_field_name: Some("fuzz1022".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + component_name: "AffixFuzzer1Indicator".into(), + archetype_field_name: None, + }, ] }); @@ -185,26 +317,26 @@ impl ::re_types_core::Archetype for AffixFuzzer1 { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: AffixFuzzer1Indicator = AffixFuzzer1Indicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -537,28 +669,226 @@ impl ::re_types_core::AsComponents for AffixFuzzer1 { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.fuzz1001 as &dyn ComponentBatch).into()), - Some((&self.fuzz1002 as &dyn ComponentBatch).into()), - Some((&self.fuzz1003 as &dyn ComponentBatch).into()), - Some((&self.fuzz1004 as &dyn ComponentBatch).into()), - Some((&self.fuzz1005 as &dyn ComponentBatch).into()), - Some((&self.fuzz1006 as &dyn ComponentBatch).into()), - Some((&self.fuzz1007 as &dyn ComponentBatch).into()), - Some((&self.fuzz1008 as &dyn ComponentBatch).into()), - Some((&self.fuzz1009 as &dyn ComponentBatch).into()), - Some((&self.fuzz1010 as &dyn ComponentBatch).into()), - Some((&self.fuzz1011 as &dyn ComponentBatch).into()), - Some((&self.fuzz1012 as &dyn ComponentBatch).into()), - Some((&self.fuzz1013 as &dyn ComponentBatch).into()), - Some((&self.fuzz1014 as &dyn ComponentBatch).into()), - Some((&self.fuzz1015 as &dyn ComponentBatch).into()), - Some((&self.fuzz1016 as &dyn ComponentBatch).into()), - Some((&self.fuzz1017 as &dyn ComponentBatch).into()), - Some((&self.fuzz1018 as &dyn ComponentBatch).into()), - Some((&self.fuzz1019 as &dyn ComponentBatch).into()), - Some((&self.fuzz1020 as &dyn ComponentBatch).into()), - Some((&self.fuzz1021 as &dyn ComponentBatch).into()), - Some((&self.fuzz1022 as &dyn ComponentBatch).into()), + (Some(&self.fuzz1001 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1001").into()), + component_name: ("rerun.testing.components.AffixFuzzer1").into(), + }), + } + }), + (Some(&self.fuzz1002 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1002").into()), + component_name: ("rerun.testing.components.AffixFuzzer2").into(), + }), + } + }), + (Some(&self.fuzz1003 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1003").into()), + component_name: ("rerun.testing.components.AffixFuzzer3").into(), + }), + } + }), + (Some(&self.fuzz1004 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1004").into()), + component_name: ("rerun.testing.components.AffixFuzzer4").into(), + }), + } + }), + (Some(&self.fuzz1005 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1005").into()), + component_name: ("rerun.testing.components.AffixFuzzer5").into(), + }), + } + }), + (Some(&self.fuzz1006 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1006").into()), + component_name: ("rerun.testing.components.AffixFuzzer6").into(), + }), + } + }), + (Some(&self.fuzz1007 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1007").into()), + component_name: ("rerun.testing.components.AffixFuzzer7").into(), + }), + } + }), + (Some(&self.fuzz1008 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1008").into()), + component_name: ("rerun.testing.components.AffixFuzzer8").into(), + }), + } + }), + (Some(&self.fuzz1009 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1009").into()), + component_name: ("rerun.testing.components.AffixFuzzer9").into(), + }), + } + }), + (Some(&self.fuzz1010 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1010").into()), + component_name: ("rerun.testing.components.AffixFuzzer10").into(), + }), + } + }), + (Some(&self.fuzz1011 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1011").into()), + component_name: ("rerun.testing.components.AffixFuzzer11").into(), + }), + } + }), + (Some(&self.fuzz1012 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1012").into()), + component_name: ("rerun.testing.components.AffixFuzzer12").into(), + }), + } + }), + (Some(&self.fuzz1013 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1013").into()), + component_name: ("rerun.testing.components.AffixFuzzer13").into(), + }), + } + }), + (Some(&self.fuzz1014 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1014").into()), + component_name: ("rerun.testing.components.AffixFuzzer14").into(), + }), + } + }), + (Some(&self.fuzz1015 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1015").into()), + component_name: ("rerun.testing.components.AffixFuzzer15").into(), + }), + } + }), + (Some(&self.fuzz1016 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1016").into()), + component_name: ("rerun.testing.components.AffixFuzzer16").into(), + }), + } + }), + (Some(&self.fuzz1017 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1017").into()), + component_name: ("rerun.testing.components.AffixFuzzer17").into(), + }), + } + }), + (Some(&self.fuzz1018 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1018").into()), + component_name: ("rerun.testing.components.AffixFuzzer18").into(), + }), + } + }), + (Some(&self.fuzz1019 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1019").into()), + component_name: ("rerun.testing.components.AffixFuzzer19").into(), + }), + } + }), + (Some(&self.fuzz1020 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1020").into()), + component_name: ("rerun.testing.components.AffixFuzzer20").into(), + }), + } + }), + (Some(&self.fuzz1021 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1021").into()), + component_name: ("rerun.testing.components.AffixFuzzer21").into(), + }), + } + }), + (Some(&self.fuzz1022 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), + archetype_field_name: Some(("fuzz1022").into()), + component_name: ("rerun.testing.components.AffixFuzzer22").into(), + }), + } + }), ] .into_iter() .flatten() @@ -621,3 +951,57 @@ impl AffixFuzzer1 { } } } + +impl ::re_types_core::SizeBytes for AffixFuzzer1 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.fuzz1001.heap_size_bytes() + + self.fuzz1002.heap_size_bytes() + + self.fuzz1003.heap_size_bytes() + + self.fuzz1004.heap_size_bytes() + + self.fuzz1005.heap_size_bytes() + + self.fuzz1006.heap_size_bytes() + + self.fuzz1007.heap_size_bytes() + + self.fuzz1008.heap_size_bytes() + + self.fuzz1009.heap_size_bytes() + + self.fuzz1010.heap_size_bytes() + + self.fuzz1011.heap_size_bytes() + + self.fuzz1012.heap_size_bytes() + + self.fuzz1013.heap_size_bytes() + + self.fuzz1014.heap_size_bytes() + + self.fuzz1015.heap_size_bytes() + + self.fuzz1016.heap_size_bytes() + + self.fuzz1017.heap_size_bytes() + + self.fuzz1018.heap_size_bytes() + + self.fuzz1019.heap_size_bytes() + + self.fuzz1020.heap_size_bytes() + + self.fuzz1021.heap_size_bytes() + + self.fuzz1022.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs b/crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs index 4132525fad07b..381ef70a35144 100644 --- a/crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs +++ b/crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, PartialEq)] @@ -41,108 +41,222 @@ pub struct AffixFuzzer2 { pub fuzz1122: Vec, } -impl ::re_types_core::SizeBytes for AffixFuzzer2 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.fuzz1101.heap_size_bytes() - + self.fuzz1102.heap_size_bytes() - + self.fuzz1103.heap_size_bytes() - + self.fuzz1104.heap_size_bytes() - + self.fuzz1105.heap_size_bytes() - + self.fuzz1106.heap_size_bytes() - + self.fuzz1107.heap_size_bytes() - + self.fuzz1108.heap_size_bytes() - + self.fuzz1109.heap_size_bytes() - + self.fuzz1110.heap_size_bytes() - + self.fuzz1111.heap_size_bytes() - + self.fuzz1112.heap_size_bytes() - + self.fuzz1113.heap_size_bytes() - + self.fuzz1114.heap_size_bytes() - + self.fuzz1115.heap_size_bytes() - + self.fuzz1116.heap_size_bytes() - + self.fuzz1117.heap_size_bytes() - + self.fuzz1118.heap_size_bytes() - + self.fuzz1122.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 19usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.testing.components.AffixFuzzer1".into(), - "rerun.testing.components.AffixFuzzer2".into(), - "rerun.testing.components.AffixFuzzer3".into(), - "rerun.testing.components.AffixFuzzer4".into(), - "rerun.testing.components.AffixFuzzer5".into(), - "rerun.testing.components.AffixFuzzer6".into(), - "rerun.testing.components.AffixFuzzer7".into(), - "rerun.testing.components.AffixFuzzer8".into(), - "rerun.testing.components.AffixFuzzer9".into(), - "rerun.testing.components.AffixFuzzer10".into(), - "rerun.testing.components.AffixFuzzer11".into(), - "rerun.testing.components.AffixFuzzer12".into(), - "rerun.testing.components.AffixFuzzer13".into(), - "rerun.testing.components.AffixFuzzer14".into(), - "rerun.testing.components.AffixFuzzer15".into(), - "rerun.testing.components.AffixFuzzer16".into(), - "rerun.testing.components.AffixFuzzer17".into(), - "rerun.testing.components.AffixFuzzer18".into(), - "rerun.testing.components.AffixFuzzer22".into(), + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer1".into(), + archetype_field_name: Some("fuzz1101".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer2".into(), + archetype_field_name: Some("fuzz1102".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer3".into(), + archetype_field_name: Some("fuzz1103".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer4".into(), + archetype_field_name: Some("fuzz1104".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer5".into(), + archetype_field_name: Some("fuzz1105".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer6".into(), + archetype_field_name: Some("fuzz1106".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer7".into(), + archetype_field_name: Some("fuzz1107".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer8".into(), + archetype_field_name: Some("fuzz1108".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer9".into(), + archetype_field_name: Some("fuzz1109".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer10".into(), + archetype_field_name: Some("fuzz1110".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer11".into(), + archetype_field_name: Some("fuzz1111".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer12".into(), + archetype_field_name: Some("fuzz1112".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer13".into(), + archetype_field_name: Some("fuzz1113".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer14".into(), + archetype_field_name: Some("fuzz1114".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer15".into(), + archetype_field_name: Some("fuzz1115".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer16".into(), + archetype_field_name: Some("fuzz1116".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer17".into(), + archetype_field_name: Some("fuzz1117".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer18".into(), + archetype_field_name: Some("fuzz1118".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer22".into(), + archetype_field_name: Some("fuzz1122".into()), + }, ] }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.testing.components.AffixFuzzer2Indicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "AffixFuzzer2Indicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 20usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 20usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.testing.components.AffixFuzzer1".into(), - "rerun.testing.components.AffixFuzzer2".into(), - "rerun.testing.components.AffixFuzzer3".into(), - "rerun.testing.components.AffixFuzzer4".into(), - "rerun.testing.components.AffixFuzzer5".into(), - "rerun.testing.components.AffixFuzzer6".into(), - "rerun.testing.components.AffixFuzzer7".into(), - "rerun.testing.components.AffixFuzzer8".into(), - "rerun.testing.components.AffixFuzzer9".into(), - "rerun.testing.components.AffixFuzzer10".into(), - "rerun.testing.components.AffixFuzzer11".into(), - "rerun.testing.components.AffixFuzzer12".into(), - "rerun.testing.components.AffixFuzzer13".into(), - "rerun.testing.components.AffixFuzzer14".into(), - "rerun.testing.components.AffixFuzzer15".into(), - "rerun.testing.components.AffixFuzzer16".into(), - "rerun.testing.components.AffixFuzzer17".into(), - "rerun.testing.components.AffixFuzzer18".into(), - "rerun.testing.components.AffixFuzzer22".into(), - "rerun.testing.components.AffixFuzzer2Indicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer1".into(), + archetype_field_name: Some("fuzz1101".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer2".into(), + archetype_field_name: Some("fuzz1102".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer3".into(), + archetype_field_name: Some("fuzz1103".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer4".into(), + archetype_field_name: Some("fuzz1104".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer5".into(), + archetype_field_name: Some("fuzz1105".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer6".into(), + archetype_field_name: Some("fuzz1106".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer7".into(), + archetype_field_name: Some("fuzz1107".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer8".into(), + archetype_field_name: Some("fuzz1108".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer9".into(), + archetype_field_name: Some("fuzz1109".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer10".into(), + archetype_field_name: Some("fuzz1110".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer11".into(), + archetype_field_name: Some("fuzz1111".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer12".into(), + archetype_field_name: Some("fuzz1112".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer13".into(), + archetype_field_name: Some("fuzz1113".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer14".into(), + archetype_field_name: Some("fuzz1114".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer15".into(), + archetype_field_name: Some("fuzz1115".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer16".into(), + archetype_field_name: Some("fuzz1116".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer17".into(), + archetype_field_name: Some("fuzz1117".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer18".into(), + archetype_field_name: Some("fuzz1118".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "rerun.testing.components.AffixFuzzer22".into(), + archetype_field_name: Some("fuzz1122".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + component_name: "AffixFuzzer2Indicator".into(), + archetype_field_name: None, + }, ] }); @@ -170,26 +284,26 @@ impl ::re_types_core::Archetype for AffixFuzzer2 { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: AffixFuzzer2Indicator = AffixFuzzer2Indicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -461,25 +575,196 @@ impl ::re_types_core::AsComponents for AffixFuzzer2 { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.fuzz1101 as &dyn ComponentBatch).into()), - Some((&self.fuzz1102 as &dyn ComponentBatch).into()), - Some((&self.fuzz1103 as &dyn ComponentBatch).into()), - Some((&self.fuzz1104 as &dyn ComponentBatch).into()), - Some((&self.fuzz1105 as &dyn ComponentBatch).into()), - Some((&self.fuzz1106 as &dyn ComponentBatch).into()), - Some((&self.fuzz1107 as &dyn ComponentBatch).into()), - Some((&self.fuzz1108 as &dyn ComponentBatch).into()), - Some((&self.fuzz1109 as &dyn ComponentBatch).into()), - Some((&self.fuzz1110 as &dyn ComponentBatch).into()), - Some((&self.fuzz1111 as &dyn ComponentBatch).into()), - Some((&self.fuzz1112 as &dyn ComponentBatch).into()), - Some((&self.fuzz1113 as &dyn ComponentBatch).into()), - Some((&self.fuzz1114 as &dyn ComponentBatch).into()), - Some((&self.fuzz1115 as &dyn ComponentBatch).into()), - Some((&self.fuzz1116 as &dyn ComponentBatch).into()), - Some((&self.fuzz1117 as &dyn ComponentBatch).into()), - Some((&self.fuzz1118 as &dyn ComponentBatch).into()), - Some((&self.fuzz1122 as &dyn ComponentBatch).into()), + (Some(&self.fuzz1101 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1101").into()), + component_name: ("rerun.testing.components.AffixFuzzer1").into(), + }), + } + }), + (Some(&self.fuzz1102 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1102").into()), + component_name: ("rerun.testing.components.AffixFuzzer2").into(), + }), + } + }), + (Some(&self.fuzz1103 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1103").into()), + component_name: ("rerun.testing.components.AffixFuzzer3").into(), + }), + } + }), + (Some(&self.fuzz1104 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1104").into()), + component_name: ("rerun.testing.components.AffixFuzzer4").into(), + }), + } + }), + (Some(&self.fuzz1105 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1105").into()), + component_name: ("rerun.testing.components.AffixFuzzer5").into(), + }), + } + }), + (Some(&self.fuzz1106 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1106").into()), + component_name: ("rerun.testing.components.AffixFuzzer6").into(), + }), + } + }), + (Some(&self.fuzz1107 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1107").into()), + component_name: ("rerun.testing.components.AffixFuzzer7").into(), + }), + } + }), + (Some(&self.fuzz1108 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1108").into()), + component_name: ("rerun.testing.components.AffixFuzzer8").into(), + }), + } + }), + (Some(&self.fuzz1109 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1109").into()), + component_name: ("rerun.testing.components.AffixFuzzer9").into(), + }), + } + }), + (Some(&self.fuzz1110 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1110").into()), + component_name: ("rerun.testing.components.AffixFuzzer10").into(), + }), + } + }), + (Some(&self.fuzz1111 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1111").into()), + component_name: ("rerun.testing.components.AffixFuzzer11").into(), + }), + } + }), + (Some(&self.fuzz1112 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1112").into()), + component_name: ("rerun.testing.components.AffixFuzzer12").into(), + }), + } + }), + (Some(&self.fuzz1113 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1113").into()), + component_name: ("rerun.testing.components.AffixFuzzer13").into(), + }), + } + }), + (Some(&self.fuzz1114 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1114").into()), + component_name: ("rerun.testing.components.AffixFuzzer14").into(), + }), + } + }), + (Some(&self.fuzz1115 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1115").into()), + component_name: ("rerun.testing.components.AffixFuzzer15").into(), + }), + } + }), + (Some(&self.fuzz1116 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1116").into()), + component_name: ("rerun.testing.components.AffixFuzzer16").into(), + }), + } + }), + (Some(&self.fuzz1117 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1117").into()), + component_name: ("rerun.testing.components.AffixFuzzer17").into(), + }), + } + }), + (Some(&self.fuzz1118 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1118").into()), + component_name: ("rerun.testing.components.AffixFuzzer18").into(), + }), + } + }), + (Some(&self.fuzz1122 as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), + archetype_field_name: Some(("fuzz1122").into()), + component_name: ("rerun.testing.components.AffixFuzzer22").into(), + }), + } + }), ] .into_iter() .flatten() @@ -536,3 +821,51 @@ impl AffixFuzzer2 { } } } + +impl ::re_types_core::SizeBytes for AffixFuzzer2 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.fuzz1101.heap_size_bytes() + + self.fuzz1102.heap_size_bytes() + + self.fuzz1103.heap_size_bytes() + + self.fuzz1104.heap_size_bytes() + + self.fuzz1105.heap_size_bytes() + + self.fuzz1106.heap_size_bytes() + + self.fuzz1107.heap_size_bytes() + + self.fuzz1108.heap_size_bytes() + + self.fuzz1109.heap_size_bytes() + + self.fuzz1110.heap_size_bytes() + + self.fuzz1111.heap_size_bytes() + + self.fuzz1112.heap_size_bytes() + + self.fuzz1113.heap_size_bytes() + + self.fuzz1114.heap_size_bytes() + + self.fuzz1115.heap_size_bytes() + + self.fuzz1116.heap_size_bytes() + + self.fuzz1117.heap_size_bytes() + + self.fuzz1118.heap_size_bytes() + + self.fuzz1122.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs b/crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs index 43efcb3de5a34..91d4303716a1f 100644 --- a/crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs +++ b/crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, PartialEq)] @@ -40,104 +40,212 @@ pub struct AffixFuzzer3 { pub fuzz2018: Option, } -impl ::re_types_core::SizeBytes for AffixFuzzer3 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.fuzz2001.heap_size_bytes() - + self.fuzz2002.heap_size_bytes() - + self.fuzz2003.heap_size_bytes() - + self.fuzz2004.heap_size_bytes() - + self.fuzz2005.heap_size_bytes() - + self.fuzz2006.heap_size_bytes() - + self.fuzz2007.heap_size_bytes() - + self.fuzz2008.heap_size_bytes() - + self.fuzz2009.heap_size_bytes() - + self.fuzz2010.heap_size_bytes() - + self.fuzz2011.heap_size_bytes() - + self.fuzz2012.heap_size_bytes() - + self.fuzz2013.heap_size_bytes() - + self.fuzz2014.heap_size_bytes() - + self.fuzz2015.heap_size_bytes() - + self.fuzz2016.heap_size_bytes() - + self.fuzz2017.heap_size_bytes() - + self.fuzz2018.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.testing.components.AffixFuzzer3Indicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "AffixFuzzer3Indicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 18usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 18usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.testing.components.AffixFuzzer1".into(), - "rerun.testing.components.AffixFuzzer2".into(), - "rerun.testing.components.AffixFuzzer3".into(), - "rerun.testing.components.AffixFuzzer4".into(), - "rerun.testing.components.AffixFuzzer5".into(), - "rerun.testing.components.AffixFuzzer6".into(), - "rerun.testing.components.AffixFuzzer7".into(), - "rerun.testing.components.AffixFuzzer8".into(), - "rerun.testing.components.AffixFuzzer9".into(), - "rerun.testing.components.AffixFuzzer10".into(), - "rerun.testing.components.AffixFuzzer11".into(), - "rerun.testing.components.AffixFuzzer12".into(), - "rerun.testing.components.AffixFuzzer13".into(), - "rerun.testing.components.AffixFuzzer14".into(), - "rerun.testing.components.AffixFuzzer15".into(), - "rerun.testing.components.AffixFuzzer16".into(), - "rerun.testing.components.AffixFuzzer17".into(), - "rerun.testing.components.AffixFuzzer18".into(), + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer1".into(), + archetype_field_name: Some("fuzz2001".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer2".into(), + archetype_field_name: Some("fuzz2002".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer3".into(), + archetype_field_name: Some("fuzz2003".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer4".into(), + archetype_field_name: Some("fuzz2004".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer5".into(), + archetype_field_name: Some("fuzz2005".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer6".into(), + archetype_field_name: Some("fuzz2006".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer7".into(), + archetype_field_name: Some("fuzz2007".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer8".into(), + archetype_field_name: Some("fuzz2008".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer9".into(), + archetype_field_name: Some("fuzz2009".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer10".into(), + archetype_field_name: Some("fuzz2010".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer11".into(), + archetype_field_name: Some("fuzz2011".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer12".into(), + archetype_field_name: Some("fuzz2012".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer13".into(), + archetype_field_name: Some("fuzz2013".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer14".into(), + archetype_field_name: Some("fuzz2014".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer15".into(), + archetype_field_name: Some("fuzz2015".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer16".into(), + archetype_field_name: Some("fuzz2016".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer17".into(), + archetype_field_name: Some("fuzz2017".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer18".into(), + archetype_field_name: Some("fuzz2018".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 19usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.testing.components.AffixFuzzer3Indicator".into(), - "rerun.testing.components.AffixFuzzer1".into(), - "rerun.testing.components.AffixFuzzer2".into(), - "rerun.testing.components.AffixFuzzer3".into(), - "rerun.testing.components.AffixFuzzer4".into(), - "rerun.testing.components.AffixFuzzer5".into(), - "rerun.testing.components.AffixFuzzer6".into(), - "rerun.testing.components.AffixFuzzer7".into(), - "rerun.testing.components.AffixFuzzer8".into(), - "rerun.testing.components.AffixFuzzer9".into(), - "rerun.testing.components.AffixFuzzer10".into(), - "rerun.testing.components.AffixFuzzer11".into(), - "rerun.testing.components.AffixFuzzer12".into(), - "rerun.testing.components.AffixFuzzer13".into(), - "rerun.testing.components.AffixFuzzer14".into(), - "rerun.testing.components.AffixFuzzer15".into(), - "rerun.testing.components.AffixFuzzer16".into(), - "rerun.testing.components.AffixFuzzer17".into(), - "rerun.testing.components.AffixFuzzer18".into(), + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "AffixFuzzer3Indicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer1".into(), + archetype_field_name: Some("fuzz2001".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer2".into(), + archetype_field_name: Some("fuzz2002".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer3".into(), + archetype_field_name: Some("fuzz2003".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer4".into(), + archetype_field_name: Some("fuzz2004".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer5".into(), + archetype_field_name: Some("fuzz2005".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer6".into(), + archetype_field_name: Some("fuzz2006".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer7".into(), + archetype_field_name: Some("fuzz2007".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer8".into(), + archetype_field_name: Some("fuzz2008".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer9".into(), + archetype_field_name: Some("fuzz2009".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer10".into(), + archetype_field_name: Some("fuzz2010".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer11".into(), + archetype_field_name: Some("fuzz2011".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer12".into(), + archetype_field_name: Some("fuzz2012".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer13".into(), + archetype_field_name: Some("fuzz2013".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer14".into(), + archetype_field_name: Some("fuzz2014".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer15".into(), + archetype_field_name: Some("fuzz2015".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer16".into(), + archetype_field_name: Some("fuzz2016".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer17".into(), + archetype_field_name: Some("fuzz2017".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + component_name: "rerun.testing.components.AffixFuzzer18".into(), + archetype_field_name: Some("fuzz2018".into()), + }, ] }); @@ -165,26 +273,26 @@ impl ::re_types_core::Archetype for AffixFuzzer3 { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: AffixFuzzer3Indicator = AffixFuzzer3Indicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -407,60 +515,222 @@ impl ::re_types_core::AsComponents for AffixFuzzer3 { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.fuzz2001 + (self + .fuzz2001 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2002 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2001").into()), + component_name: ("rerun.testing.components.AffixFuzzer1").into(), + }), + }), + (self + .fuzz2002 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2003 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2002").into()), + component_name: ("rerun.testing.components.AffixFuzzer2").into(), + }), + }), + (self + .fuzz2003 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2004 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2003").into()), + component_name: ("rerun.testing.components.AffixFuzzer3").into(), + }), + }), + (self + .fuzz2004 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2005 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2004").into()), + component_name: ("rerun.testing.components.AffixFuzzer4").into(), + }), + }), + (self + .fuzz2005 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2006 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2005").into()), + component_name: ("rerun.testing.components.AffixFuzzer5").into(), + }), + }), + (self + .fuzz2006 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2007 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2006").into()), + component_name: ("rerun.testing.components.AffixFuzzer6").into(), + }), + }), + (self + .fuzz2007 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2008 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2007").into()), + component_name: ("rerun.testing.components.AffixFuzzer7").into(), + }), + }), + (self + .fuzz2008 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2009 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2008").into()), + component_name: ("rerun.testing.components.AffixFuzzer8").into(), + }), + }), + (self + .fuzz2009 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2010 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2009").into()), + component_name: ("rerun.testing.components.AffixFuzzer9").into(), + }), + }), + (self + .fuzz2010 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2011 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2010").into()), + component_name: ("rerun.testing.components.AffixFuzzer10").into(), + }), + }), + (self + .fuzz2011 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2012 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2011").into()), + component_name: ("rerun.testing.components.AffixFuzzer11").into(), + }), + }), + (self + .fuzz2012 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2013 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2012").into()), + component_name: ("rerun.testing.components.AffixFuzzer12").into(), + }), + }), + (self + .fuzz2013 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2014 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2013").into()), + component_name: ("rerun.testing.components.AffixFuzzer13").into(), + }), + }), + (self + .fuzz2014 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2015 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2014").into()), + component_name: ("rerun.testing.components.AffixFuzzer14").into(), + }), + }), + (self + .fuzz2015 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2016 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2015").into()), + component_name: ("rerun.testing.components.AffixFuzzer15").into(), + }), + }), + (self + .fuzz2016 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2017 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2016").into()), + component_name: ("rerun.testing.components.AffixFuzzer16").into(), + }), + }), + (self + .fuzz2017 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.fuzz2018 + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2017").into()), + component_name: ("rerun.testing.components.AffixFuzzer17").into(), + }), + }), + (self + .fuzz2018 .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), + archetype_field_name: Some(("fuzz2018").into()), + component_name: ("rerun.testing.components.AffixFuzzer18").into(), + }), + }), ] .into_iter() .flatten() @@ -658,3 +928,49 @@ impl AffixFuzzer3 { self } } + +impl ::re_types_core::SizeBytes for AffixFuzzer3 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.fuzz2001.heap_size_bytes() + + self.fuzz2002.heap_size_bytes() + + self.fuzz2003.heap_size_bytes() + + self.fuzz2004.heap_size_bytes() + + self.fuzz2005.heap_size_bytes() + + self.fuzz2006.heap_size_bytes() + + self.fuzz2007.heap_size_bytes() + + self.fuzz2008.heap_size_bytes() + + self.fuzz2009.heap_size_bytes() + + self.fuzz2010.heap_size_bytes() + + self.fuzz2011.heap_size_bytes() + + self.fuzz2012.heap_size_bytes() + + self.fuzz2013.heap_size_bytes() + + self.fuzz2014.heap_size_bytes() + + self.fuzz2015.heap_size_bytes() + + self.fuzz2016.heap_size_bytes() + + self.fuzz2017.heap_size_bytes() + + self.fuzz2018.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs b/crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs index 9d5b71b91a8ff..8ae5d3b81bef8 100644 --- a/crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs +++ b/crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, PartialEq)] @@ -40,104 +40,212 @@ pub struct AffixFuzzer4 { pub fuzz2118: Option>, } -impl ::re_types_core::SizeBytes for AffixFuzzer4 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.fuzz2101.heap_size_bytes() - + self.fuzz2102.heap_size_bytes() - + self.fuzz2103.heap_size_bytes() - + self.fuzz2104.heap_size_bytes() - + self.fuzz2105.heap_size_bytes() - + self.fuzz2106.heap_size_bytes() - + self.fuzz2107.heap_size_bytes() - + self.fuzz2108.heap_size_bytes() - + self.fuzz2109.heap_size_bytes() - + self.fuzz2110.heap_size_bytes() - + self.fuzz2111.heap_size_bytes() - + self.fuzz2112.heap_size_bytes() - + self.fuzz2113.heap_size_bytes() - + self.fuzz2114.heap_size_bytes() - + self.fuzz2115.heap_size_bytes() - + self.fuzz2116.heap_size_bytes() - + self.fuzz2117.heap_size_bytes() - + self.fuzz2118.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.testing.components.AffixFuzzer4Indicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "AffixFuzzer4Indicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 18usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 18usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.testing.components.AffixFuzzer1".into(), - "rerun.testing.components.AffixFuzzer2".into(), - "rerun.testing.components.AffixFuzzer3".into(), - "rerun.testing.components.AffixFuzzer4".into(), - "rerun.testing.components.AffixFuzzer5".into(), - "rerun.testing.components.AffixFuzzer6".into(), - "rerun.testing.components.AffixFuzzer7".into(), - "rerun.testing.components.AffixFuzzer8".into(), - "rerun.testing.components.AffixFuzzer9".into(), - "rerun.testing.components.AffixFuzzer10".into(), - "rerun.testing.components.AffixFuzzer11".into(), - "rerun.testing.components.AffixFuzzer12".into(), - "rerun.testing.components.AffixFuzzer13".into(), - "rerun.testing.components.AffixFuzzer14".into(), - "rerun.testing.components.AffixFuzzer15".into(), - "rerun.testing.components.AffixFuzzer16".into(), - "rerun.testing.components.AffixFuzzer17".into(), - "rerun.testing.components.AffixFuzzer18".into(), + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer1".into(), + archetype_field_name: Some("fuzz2101".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer2".into(), + archetype_field_name: Some("fuzz2102".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer3".into(), + archetype_field_name: Some("fuzz2103".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer4".into(), + archetype_field_name: Some("fuzz2104".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer5".into(), + archetype_field_name: Some("fuzz2105".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer6".into(), + archetype_field_name: Some("fuzz2106".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer7".into(), + archetype_field_name: Some("fuzz2107".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer8".into(), + archetype_field_name: Some("fuzz2108".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer9".into(), + archetype_field_name: Some("fuzz2109".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer10".into(), + archetype_field_name: Some("fuzz2110".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer11".into(), + archetype_field_name: Some("fuzz2111".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer12".into(), + archetype_field_name: Some("fuzz2112".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer13".into(), + archetype_field_name: Some("fuzz2113".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer14".into(), + archetype_field_name: Some("fuzz2114".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer15".into(), + archetype_field_name: Some("fuzz2115".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer16".into(), + archetype_field_name: Some("fuzz2116".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer17".into(), + archetype_field_name: Some("fuzz2117".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer18".into(), + archetype_field_name: Some("fuzz2118".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 19usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.testing.components.AffixFuzzer4Indicator".into(), - "rerun.testing.components.AffixFuzzer1".into(), - "rerun.testing.components.AffixFuzzer2".into(), - "rerun.testing.components.AffixFuzzer3".into(), - "rerun.testing.components.AffixFuzzer4".into(), - "rerun.testing.components.AffixFuzzer5".into(), - "rerun.testing.components.AffixFuzzer6".into(), - "rerun.testing.components.AffixFuzzer7".into(), - "rerun.testing.components.AffixFuzzer8".into(), - "rerun.testing.components.AffixFuzzer9".into(), - "rerun.testing.components.AffixFuzzer10".into(), - "rerun.testing.components.AffixFuzzer11".into(), - "rerun.testing.components.AffixFuzzer12".into(), - "rerun.testing.components.AffixFuzzer13".into(), - "rerun.testing.components.AffixFuzzer14".into(), - "rerun.testing.components.AffixFuzzer15".into(), - "rerun.testing.components.AffixFuzzer16".into(), - "rerun.testing.components.AffixFuzzer17".into(), - "rerun.testing.components.AffixFuzzer18".into(), + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "AffixFuzzer4Indicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer1".into(), + archetype_field_name: Some("fuzz2101".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer2".into(), + archetype_field_name: Some("fuzz2102".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer3".into(), + archetype_field_name: Some("fuzz2103".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer4".into(), + archetype_field_name: Some("fuzz2104".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer5".into(), + archetype_field_name: Some("fuzz2105".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer6".into(), + archetype_field_name: Some("fuzz2106".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer7".into(), + archetype_field_name: Some("fuzz2107".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer8".into(), + archetype_field_name: Some("fuzz2108".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer9".into(), + archetype_field_name: Some("fuzz2109".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer10".into(), + archetype_field_name: Some("fuzz2110".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer11".into(), + archetype_field_name: Some("fuzz2111".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer12".into(), + archetype_field_name: Some("fuzz2112".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer13".into(), + archetype_field_name: Some("fuzz2113".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer14".into(), + archetype_field_name: Some("fuzz2114".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer15".into(), + archetype_field_name: Some("fuzz2115".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer16".into(), + archetype_field_name: Some("fuzz2116".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer17".into(), + archetype_field_name: Some("fuzz2117".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + component_name: "rerun.testing.components.AffixFuzzer18".into(), + archetype_field_name: Some("fuzz2118".into()), + }, ] }); @@ -165,26 +273,26 @@ impl ::re_types_core::Archetype for AffixFuzzer4 { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: AffixFuzzer4Indicator = AffixFuzzer4Indicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -461,60 +569,222 @@ impl ::re_types_core::AsComponents for AffixFuzzer4 { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.fuzz2101 + (self + .fuzz2101 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2102 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2101").into()), + component_name: ("rerun.testing.components.AffixFuzzer1").into(), + }), + }), + (self + .fuzz2102 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2103 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2102").into()), + component_name: ("rerun.testing.components.AffixFuzzer2").into(), + }), + }), + (self + .fuzz2103 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2104 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2103").into()), + component_name: ("rerun.testing.components.AffixFuzzer3").into(), + }), + }), + (self + .fuzz2104 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2105 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2104").into()), + component_name: ("rerun.testing.components.AffixFuzzer4").into(), + }), + }), + (self + .fuzz2105 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2106 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2105").into()), + component_name: ("rerun.testing.components.AffixFuzzer5").into(), + }), + }), + (self + .fuzz2106 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2107 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2106").into()), + component_name: ("rerun.testing.components.AffixFuzzer6").into(), + }), + }), + (self + .fuzz2107 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2108 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2107").into()), + component_name: ("rerun.testing.components.AffixFuzzer7").into(), + }), + }), + (self + .fuzz2108 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2109 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2108").into()), + component_name: ("rerun.testing.components.AffixFuzzer8").into(), + }), + }), + (self + .fuzz2109 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2110 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2109").into()), + component_name: ("rerun.testing.components.AffixFuzzer9").into(), + }), + }), + (self + .fuzz2110 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2111 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2110").into()), + component_name: ("rerun.testing.components.AffixFuzzer10").into(), + }), + }), + (self + .fuzz2111 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2112 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2111").into()), + component_name: ("rerun.testing.components.AffixFuzzer11").into(), + }), + }), + (self + .fuzz2112 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2113 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2112").into()), + component_name: ("rerun.testing.components.AffixFuzzer12").into(), + }), + }), + (self + .fuzz2113 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2114 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2113").into()), + component_name: ("rerun.testing.components.AffixFuzzer13").into(), + }), + }), + (self + .fuzz2114 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2115 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2114").into()), + component_name: ("rerun.testing.components.AffixFuzzer14").into(), + }), + }), + (self + .fuzz2115 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2116 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2115").into()), + component_name: ("rerun.testing.components.AffixFuzzer15").into(), + }), + }), + (self + .fuzz2116 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2117 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2116").into()), + component_name: ("rerun.testing.components.AffixFuzzer16").into(), + }), + }), + (self + .fuzz2117 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.fuzz2118 + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2117").into()), + component_name: ("rerun.testing.components.AffixFuzzer17").into(), + }), + }), + (self + .fuzz2118 .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), + archetype_field_name: Some(("fuzz2118").into()), + component_name: ("rerun.testing.components.AffixFuzzer18").into(), + }), + }), ] .into_iter() .flatten() @@ -712,3 +982,49 @@ impl AffixFuzzer4 { self } } + +impl ::re_types_core::SizeBytes for AffixFuzzer4 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.fuzz2101.heap_size_bytes() + + self.fuzz2102.heap_size_bytes() + + self.fuzz2103.heap_size_bytes() + + self.fuzz2104.heap_size_bytes() + + self.fuzz2105.heap_size_bytes() + + self.fuzz2106.heap_size_bytes() + + self.fuzz2107.heap_size_bytes() + + self.fuzz2108.heap_size_bytes() + + self.fuzz2109.heap_size_bytes() + + self.fuzz2110.heap_size_bytes() + + self.fuzz2111.heap_size_bytes() + + self.fuzz2112.heap_size_bytes() + + self.fuzz2113.heap_size_bytes() + + self.fuzz2114.heap_size_bytes() + + self.fuzz2115.heap_size_bytes() + + self.fuzz2116.heap_size_bytes() + + self.fuzz2117.heap_size_bytes() + + self.fuzz2118.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer1.rs b/crates/store/re_types/src/testing/components/affix_fuzzer1.rs index 9298314273969..32ae6a19fcac8 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer1.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer1.rs @@ -13,23 +13,51 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer1(pub crate::testing::datatypes::AffixFuzzer1); -impl ::re_types_core::SizeBytes for AffixFuzzer1 { +impl ::re_types_core::Component for AffixFuzzer1 { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer1") } +} +::re_types_core::macros::impl_into_cow!(AffixFuzzer1); + +impl ::re_types_core::Loggable for AffixFuzzer1 { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::testing::datatypes::AffixFuzzer1::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::testing::datatypes::AffixFuzzer1::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::testing::datatypes::AffixFuzzer1::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -62,42 +90,14 @@ impl std::ops::DerefMut for AffixFuzzer1 { } } -::re_types_core::macros::impl_into_cow!(AffixFuzzer1); - -impl ::re_types_core::Loggable for AffixFuzzer1 { +impl ::re_types_core::SizeBytes for AffixFuzzer1 { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::testing::datatypes::AffixFuzzer1::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::testing::datatypes::AffixFuzzer1::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::testing::datatypes::AffixFuzzer1::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AffixFuzzer1 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer1".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer10.rs b/crates/store/re_types/src/testing/components/affix_fuzzer10.rs index b73afe90515b0..42e633a56a081 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer10.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer10.rs @@ -13,53 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct AffixFuzzer10(pub Option<::re_types_core::ArrowString>); -impl ::re_types_core::SizeBytes for AffixFuzzer10 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl From> for AffixFuzzer10 { - #[inline] - fn from(single_string_optional: Option<::re_types_core::ArrowString>) -> Self { - Self(single_string_optional) - } -} - -impl From for Option<::re_types_core::ArrowString> { - #[inline] - fn from(value: AffixFuzzer10) -> Self { - value.0 - } -} - -impl std::ops::Deref for AffixFuzzer10 { - type Target = Option<::re_types_core::ArrowString>; - - #[inline] - fn deref(&self) -> &Option<::re_types_core::ArrowString> { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer10 { +impl ::re_types_core::Component for AffixFuzzer10 { #[inline] - fn deref_mut(&mut self) -> &mut Option<::re_types_core::ArrowString> { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer10") } } @@ -176,9 +141,44 @@ impl ::re_types_core::Loggable for AffixFuzzer10 { } } -impl ::re_types_core::Component for AffixFuzzer10 { +impl From> for AffixFuzzer10 { + #[inline] + fn from(single_string_optional: Option<::re_types_core::ArrowString>) -> Self { + Self(single_string_optional) + } +} + +impl From for Option<::re_types_core::ArrowString> { + #[inline] + fn from(value: AffixFuzzer10) -> Self { + value.0 + } +} + +impl std::ops::Deref for AffixFuzzer10 { + type Target = Option<::re_types_core::ArrowString>; + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer10".into() + fn deref(&self) -> &Option<::re_types_core::ArrowString> { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer10 { + #[inline] + fn deref_mut(&mut self) -> &mut Option<::re_types_core::ArrowString> { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer10 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer11.rs b/crates/store/re_types/src/testing/components/affix_fuzzer11.rs index d3e65fae1d355..d08eaadd18c25 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer11.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer11.rs @@ -13,53 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer11(pub Option<::re_types_core::ArrowBuffer>); -impl ::re_types_core::SizeBytes for AffixFuzzer11 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >>::is_pod() - } -} - -impl From>> for AffixFuzzer11 { - #[inline] - fn from(many_floats_optional: Option<::re_types_core::ArrowBuffer>) -> Self { - Self(many_floats_optional) - } -} - -impl From for Option<::re_types_core::ArrowBuffer> { - #[inline] - fn from(value: AffixFuzzer11) -> Self { - value.0 - } -} - -impl std::ops::Deref for AffixFuzzer11 { - type Target = Option<::re_types_core::ArrowBuffer>; - - #[inline] - fn deref(&self) -> &Option<::re_types_core::ArrowBuffer> { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer11 { +impl ::re_types_core::Component for AffixFuzzer11 { #[inline] - fn deref_mut(&mut self) -> &mut Option<::re_types_core::ArrowBuffer> { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer11") } } @@ -209,9 +174,44 @@ impl ::re_types_core::Loggable for AffixFuzzer11 { } } -impl ::re_types_core::Component for AffixFuzzer11 { +impl From>> for AffixFuzzer11 { + #[inline] + fn from(many_floats_optional: Option<::re_types_core::ArrowBuffer>) -> Self { + Self(many_floats_optional) + } +} + +impl From for Option<::re_types_core::ArrowBuffer> { + #[inline] + fn from(value: AffixFuzzer11) -> Self { + value.0 + } +} + +impl std::ops::Deref for AffixFuzzer11 { + type Target = Option<::re_types_core::ArrowBuffer>; + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer11".into() + fn deref(&self) -> &Option<::re_types_core::ArrowBuffer> { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer11 { + #[inline] + fn deref_mut(&mut self) -> &mut Option<::re_types_core::ArrowBuffer> { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer11 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >>::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer12.rs b/crates/store/re_types/src/testing/components/affix_fuzzer12.rs index 956c0138a3c55..3ed07e91b081d 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer12.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer12.rs @@ -13,53 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct AffixFuzzer12(pub Vec<::re_types_core::ArrowString>); -impl ::re_types_core::SizeBytes for AffixFuzzer12 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl From> for AffixFuzzer12 { - #[inline] - fn from(many_strings_required: Vec<::re_types_core::ArrowString>) -> Self { - Self(many_strings_required) - } -} - -impl From for Vec<::re_types_core::ArrowString> { - #[inline] - fn from(value: AffixFuzzer12) -> Self { - value.0 - } -} - -impl std::ops::Deref for AffixFuzzer12 { - type Target = Vec<::re_types_core::ArrowString>; - - #[inline] - fn deref(&self) -> &Vec<::re_types_core::ArrowString> { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer12 { +impl ::re_types_core::Component for AffixFuzzer12 { #[inline] - fn deref_mut(&mut self) -> &mut Vec<::re_types_core::ArrowString> { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer12") } } @@ -248,9 +213,44 @@ impl ::re_types_core::Loggable for AffixFuzzer12 { } } -impl ::re_types_core::Component for AffixFuzzer12 { +impl From> for AffixFuzzer12 { + #[inline] + fn from(many_strings_required: Vec<::re_types_core::ArrowString>) -> Self { + Self(many_strings_required) + } +} + +impl From for Vec<::re_types_core::ArrowString> { + #[inline] + fn from(value: AffixFuzzer12) -> Self { + value.0 + } +} + +impl std::ops::Deref for AffixFuzzer12 { + type Target = Vec<::re_types_core::ArrowString>; + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer12".into() + fn deref(&self) -> &Vec<::re_types_core::ArrowString> { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer12 { + #[inline] + fn deref_mut(&mut self) -> &mut Vec<::re_types_core::ArrowString> { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer12 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer13.rs b/crates/store/re_types/src/testing/components/affix_fuzzer13.rs index 6f1383be46fd8..e909bf4fef593 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer13.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer13.rs @@ -13,53 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct AffixFuzzer13(pub Option>); -impl ::re_types_core::SizeBytes for AffixFuzzer13 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >>::is_pod() - } -} - -impl From>> for AffixFuzzer13 { - #[inline] - fn from(many_strings_optional: Option>) -> Self { - Self(many_strings_optional) - } -} - -impl From for Option> { - #[inline] - fn from(value: AffixFuzzer13) -> Self { - value.0 - } -} - -impl std::ops::Deref for AffixFuzzer13 { - type Target = Option>; - - #[inline] - fn deref(&self) -> &Option> { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer13 { +impl ::re_types_core::Component for AffixFuzzer13 { #[inline] - fn deref_mut(&mut self) -> &mut Option> { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer13") } } @@ -248,9 +213,44 @@ impl ::re_types_core::Loggable for AffixFuzzer13 { } } -impl ::re_types_core::Component for AffixFuzzer13 { +impl From>> for AffixFuzzer13 { + #[inline] + fn from(many_strings_optional: Option>) -> Self { + Self(many_strings_optional) + } +} + +impl From for Option> { + #[inline] + fn from(value: AffixFuzzer13) -> Self { + value.0 + } +} + +impl std::ops::Deref for AffixFuzzer13 { + type Target = Option>; + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer13".into() + fn deref(&self) -> &Option> { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer13 { + #[inline] + fn deref_mut(&mut self) -> &mut Option> { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer13 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >>::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer14.rs b/crates/store/re_types/src/testing/components/affix_fuzzer14.rs index 54ad6a98da8aa..e2c7603d775d9 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer14.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer14.rs @@ -13,23 +13,51 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer14(pub crate::testing::datatypes::AffixFuzzer3); -impl ::re_types_core::SizeBytes for AffixFuzzer14 { +impl ::re_types_core::Component for AffixFuzzer14 { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer14") } +} +::re_types_core::macros::impl_into_cow!(AffixFuzzer14); + +impl ::re_types_core::Loggable for AffixFuzzer14 { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::testing::datatypes::AffixFuzzer3::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::testing::datatypes::AffixFuzzer3::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::testing::datatypes::AffixFuzzer3::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -62,42 +90,14 @@ impl std::ops::DerefMut for AffixFuzzer14 { } } -::re_types_core::macros::impl_into_cow!(AffixFuzzer14); - -impl ::re_types_core::Loggable for AffixFuzzer14 { +impl ::re_types_core::SizeBytes for AffixFuzzer14 { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::testing::datatypes::AffixFuzzer3::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::testing::datatypes::AffixFuzzer3::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::testing::datatypes::AffixFuzzer3::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AffixFuzzer14 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer14".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer15.rs b/crates/store/re_types/src/testing/components/affix_fuzzer15.rs index bf4d7ada4791c..d96bf5874126c 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer15.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer15.rs @@ -13,52 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer15(pub Option); -impl ::re_types_core::SizeBytes for AffixFuzzer15 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl>> From for AffixFuzzer15 { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow> for AffixFuzzer15 { - #[inline] - fn borrow(&self) -> &Option { - &self.0 - } -} - -impl std::ops::Deref for AffixFuzzer15 { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer15 { +impl ::re_types_core::Component for AffixFuzzer15 { #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer15") } } @@ -157,9 +123,43 @@ impl ::re_types_core::Loggable for AffixFuzzer15 { } } -impl ::re_types_core::Component for AffixFuzzer15 { +impl>> From for AffixFuzzer15 { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow> for AffixFuzzer15 { + #[inline] + fn borrow(&self) -> &Option { + &self.0 + } +} + +impl std::ops::Deref for AffixFuzzer15 { + type Target = Option; + + #[inline] + fn deref(&self) -> &Option { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer15 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer15".into() + fn deref_mut(&mut self) -> &mut Option { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer15 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer16.rs b/crates/store/re_types/src/testing/components/affix_fuzzer16.rs index 783e0f901b5a8..739f54d7b3807 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer16.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer16.rs @@ -13,31 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer16(pub Vec); -impl ::re_types_core::SizeBytes for AffixFuzzer16 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - +impl ::re_types_core::Component for AffixFuzzer16 { #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl, T: IntoIterator> From - for AffixFuzzer16 -{ - fn from(v: T) -> Self { - Self(v.into_iter().map(|v| v.into()).collect()) + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer16") } } @@ -181,9 +168,22 @@ impl ::re_types_core::Loggable for AffixFuzzer16 { } } -impl ::re_types_core::Component for AffixFuzzer16 { +impl, T: IntoIterator> From + for AffixFuzzer16 +{ + fn from(v: T) -> Self { + Self(v.into_iter().map(|v| v.into()).collect()) + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer16 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer16".into() + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer17.rs b/crates/store/re_types/src/testing/components/affix_fuzzer17.rs index 1a63cb86585e2..5f097b3da60c3 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer17.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer17.rs @@ -13,31 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer17(pub Option>); -impl ::re_types_core::SizeBytes for AffixFuzzer17 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - +impl ::re_types_core::Component for AffixFuzzer17 { #[inline] - fn is_pod() -> bool { - >>::is_pod() - } -} - -impl, T: IntoIterator> From> - for AffixFuzzer17 -{ - fn from(v: Option) -> Self { - Self(v.map(|v| v.into_iter().map(|v| v.into()).collect())) + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer17") } } @@ -181,9 +168,22 @@ impl ::re_types_core::Loggable for AffixFuzzer17 { } } -impl ::re_types_core::Component for AffixFuzzer17 { +impl, T: IntoIterator> From> + for AffixFuzzer17 +{ + fn from(v: Option) -> Self { + Self(v.map(|v| v.into_iter().map(|v| v.into()).collect())) + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer17 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer17".into() + fn is_pod() -> bool { + >>::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer18.rs b/crates/store/re_types/src/testing/components/affix_fuzzer18.rs index 231b40067c0bb..f02336a40716c 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer18.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer18.rs @@ -13,31 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer18(pub Option>); -impl ::re_types_core::SizeBytes for AffixFuzzer18 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - +impl ::re_types_core::Component for AffixFuzzer18 { #[inline] - fn is_pod() -> bool { - >>::is_pod() - } -} - -impl, T: IntoIterator> From> - for AffixFuzzer18 -{ - fn from(v: Option) -> Self { - Self(v.map(|v| v.into_iter().map(|v| v.into()).collect())) + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer18") } } @@ -181,9 +168,22 @@ impl ::re_types_core::Loggable for AffixFuzzer18 { } } -impl ::re_types_core::Component for AffixFuzzer18 { +impl, T: IntoIterator> From> + for AffixFuzzer18 +{ + fn from(v: Option) -> Self { + Self(v.map(|v| v.into_iter().map(|v| v.into()).collect())) + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer18 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer18".into() + fn is_pod() -> bool { + >>::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer19.rs b/crates/store/re_types/src/testing/components/affix_fuzzer19.rs index 5e14eb383e73e..f8a1650a4d469 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer19.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer19.rs @@ -13,23 +13,51 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer19(pub crate::testing::datatypes::AffixFuzzer5); -impl ::re_types_core::SizeBytes for AffixFuzzer19 { +impl ::re_types_core::Component for AffixFuzzer19 { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer19") } +} +::re_types_core::macros::impl_into_cow!(AffixFuzzer19); + +impl ::re_types_core::Loggable for AffixFuzzer19 { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::testing::datatypes::AffixFuzzer5::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::testing::datatypes::AffixFuzzer5::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::testing::datatypes::AffixFuzzer5::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -62,42 +90,14 @@ impl std::ops::DerefMut for AffixFuzzer19 { } } -::re_types_core::macros::impl_into_cow!(AffixFuzzer19); - -impl ::re_types_core::Loggable for AffixFuzzer19 { +impl ::re_types_core::SizeBytes for AffixFuzzer19 { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::testing::datatypes::AffixFuzzer5::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::testing::datatypes::AffixFuzzer5::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::testing::datatypes::AffixFuzzer5::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AffixFuzzer19 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer19".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer2.rs b/crates/store/re_types/src/testing/components/affix_fuzzer2.rs index f8d0d3f36646b..f5ab2bf386a97 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer2.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer2.rs @@ -13,23 +13,51 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer2(pub crate::testing::datatypes::AffixFuzzer1); -impl ::re_types_core::SizeBytes for AffixFuzzer2 { +impl ::re_types_core::Component for AffixFuzzer2 { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer2") } +} +::re_types_core::macros::impl_into_cow!(AffixFuzzer2); + +impl ::re_types_core::Loggable for AffixFuzzer2 { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::testing::datatypes::AffixFuzzer1::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::testing::datatypes::AffixFuzzer1::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::testing::datatypes::AffixFuzzer1::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -62,42 +90,14 @@ impl std::ops::DerefMut for AffixFuzzer2 { } } -::re_types_core::macros::impl_into_cow!(AffixFuzzer2); - -impl ::re_types_core::Loggable for AffixFuzzer2 { +impl ::re_types_core::SizeBytes for AffixFuzzer2 { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::testing::datatypes::AffixFuzzer1::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::testing::datatypes::AffixFuzzer1::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::testing::datatypes::AffixFuzzer1::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AffixFuzzer2 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer2".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer20.rs b/crates/store/re_types/src/testing/components/affix_fuzzer20.rs index e856fac201c08..9dde743a0536b 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer20.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer20.rs @@ -13,23 +13,51 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct AffixFuzzer20(pub crate::testing::datatypes::AffixFuzzer20); -impl ::re_types_core::SizeBytes for AffixFuzzer20 { +impl ::re_types_core::Component for AffixFuzzer20 { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer20") } +} +::re_types_core::macros::impl_into_cow!(AffixFuzzer20); + +impl ::re_types_core::Loggable for AffixFuzzer20 { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::testing::datatypes::AffixFuzzer20::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::testing::datatypes::AffixFuzzer20::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::testing::datatypes::AffixFuzzer20::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -62,42 +90,14 @@ impl std::ops::DerefMut for AffixFuzzer20 { } } -::re_types_core::macros::impl_into_cow!(AffixFuzzer20); - -impl ::re_types_core::Loggable for AffixFuzzer20 { +impl ::re_types_core::SizeBytes for AffixFuzzer20 { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::testing::datatypes::AffixFuzzer20::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::testing::datatypes::AffixFuzzer20::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::testing::datatypes::AffixFuzzer20::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AffixFuzzer20 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer20".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer21.rs b/crates/store/re_types/src/testing/components/affix_fuzzer21.rs index c0e0e19df83b6..be7c3a5531742 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer21.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer21.rs @@ -13,23 +13,51 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer21(pub crate::testing::datatypes::AffixFuzzer21); -impl ::re_types_core::SizeBytes for AffixFuzzer21 { +impl ::re_types_core::Component for AffixFuzzer21 { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer21") } +} +::re_types_core::macros::impl_into_cow!(AffixFuzzer21); + +impl ::re_types_core::Loggable for AffixFuzzer21 { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::testing::datatypes::AffixFuzzer21::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::testing::datatypes::AffixFuzzer21::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::testing::datatypes::AffixFuzzer21::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -62,42 +90,14 @@ impl std::ops::DerefMut for AffixFuzzer21 { } } -::re_types_core::macros::impl_into_cow!(AffixFuzzer21); - -impl ::re_types_core::Loggable for AffixFuzzer21 { +impl ::re_types_core::SizeBytes for AffixFuzzer21 { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::testing::datatypes::AffixFuzzer21::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::testing::datatypes::AffixFuzzer21::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::testing::datatypes::AffixFuzzer21::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AffixFuzzer21 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer21".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer22.rs b/crates/store/re_types/src/testing/components/affix_fuzzer22.rs index 5e7ca35ae2ef5..e03d77bc94d45 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer22.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer22.rs @@ -13,52 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct AffixFuzzer22(pub Option); -impl ::re_types_core::SizeBytes for AffixFuzzer22 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl>> From for AffixFuzzer22 { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow> for AffixFuzzer22 { - #[inline] - fn borrow(&self) -> &Option { - &self.0 - } -} - -impl std::ops::Deref for AffixFuzzer22 { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer22 { +impl ::re_types_core::Component for AffixFuzzer22 { #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer22") } } @@ -137,9 +103,43 @@ impl ::re_types_core::Loggable for AffixFuzzer22 { } } -impl ::re_types_core::Component for AffixFuzzer22 { +impl>> From for AffixFuzzer22 { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow> for AffixFuzzer22 { + #[inline] + fn borrow(&self) -> &Option { + &self.0 + } +} + +impl std::ops::Deref for AffixFuzzer22 { + type Target = Option; + + #[inline] + fn deref(&self) -> &Option { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer22 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer22".into() + fn deref_mut(&mut self) -> &mut Option { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer22 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer23.rs b/crates/store/re_types/src/testing/components/affix_fuzzer23.rs index c35246cbc236c..cfcd6dbab290a 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer23.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer23.rs @@ -13,52 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct AffixFuzzer23(pub Option); -impl ::re_types_core::SizeBytes for AffixFuzzer23 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl>> From for AffixFuzzer23 { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow> for AffixFuzzer23 { - #[inline] - fn borrow(&self) -> &Option { - &self.0 - } -} - -impl std::ops::Deref for AffixFuzzer23 { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer23 { +impl ::re_types_core::Component for AffixFuzzer23 { #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer23") } } @@ -141,9 +107,43 @@ impl ::re_types_core::Loggable for AffixFuzzer23 { } } -impl ::re_types_core::Component for AffixFuzzer23 { +impl>> From for AffixFuzzer23 { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow> for AffixFuzzer23 { + #[inline] + fn borrow(&self) -> &Option { + &self.0 + } +} + +impl std::ops::Deref for AffixFuzzer23 { + type Target = Option; + + #[inline] + fn deref(&self) -> &Option { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer23 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer23".into() + fn deref_mut(&mut self) -> &mut Option { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer23 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer3.rs b/crates/store/re_types/src/testing/components/affix_fuzzer3.rs index ba87966d50a93..11a0b714c8c23 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer3.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer3.rs @@ -13,23 +13,51 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer3(pub crate::testing::datatypes::AffixFuzzer1); -impl ::re_types_core::SizeBytes for AffixFuzzer3 { +impl ::re_types_core::Component for AffixFuzzer3 { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer3") } +} +::re_types_core::macros::impl_into_cow!(AffixFuzzer3); + +impl ::re_types_core::Loggable for AffixFuzzer3 { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::testing::datatypes::AffixFuzzer1::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::testing::datatypes::AffixFuzzer1::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::testing::datatypes::AffixFuzzer1::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -62,42 +90,14 @@ impl std::ops::DerefMut for AffixFuzzer3 { } } -::re_types_core::macros::impl_into_cow!(AffixFuzzer3); - -impl ::re_types_core::Loggable for AffixFuzzer3 { +impl ::re_types_core::SizeBytes for AffixFuzzer3 { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::testing::datatypes::AffixFuzzer1::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::testing::datatypes::AffixFuzzer1::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::testing::datatypes::AffixFuzzer1::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AffixFuzzer3 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer3".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer4.rs b/crates/store/re_types/src/testing/components/affix_fuzzer4.rs index 4f161e22f2773..508d15d8a911e 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer4.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer4.rs @@ -13,52 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer4(pub Option); -impl ::re_types_core::SizeBytes for AffixFuzzer4 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl>> From for AffixFuzzer4 { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow> for AffixFuzzer4 { - #[inline] - fn borrow(&self) -> &Option { - &self.0 - } -} - -impl std::ops::Deref for AffixFuzzer4 { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer4 { +impl ::re_types_core::Component for AffixFuzzer4 { #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer4") } } @@ -168,9 +134,43 @@ impl ::re_types_core::Loggable for AffixFuzzer4 { } } -impl ::re_types_core::Component for AffixFuzzer4 { +impl>> From for AffixFuzzer4 { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow> for AffixFuzzer4 { + #[inline] + fn borrow(&self) -> &Option { + &self.0 + } +} + +impl std::ops::Deref for AffixFuzzer4 { + type Target = Option; + + #[inline] + fn deref(&self) -> &Option { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer4 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer4".into() + fn deref_mut(&mut self) -> &mut Option { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer4 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer5.rs b/crates/store/re_types/src/testing/components/affix_fuzzer5.rs index aedec46b86cc6..f810e5cf2428d 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer5.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer5.rs @@ -13,52 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer5(pub Option); -impl ::re_types_core::SizeBytes for AffixFuzzer5 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl>> From for AffixFuzzer5 { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow> for AffixFuzzer5 { - #[inline] - fn borrow(&self) -> &Option { - &self.0 - } -} - -impl std::ops::Deref for AffixFuzzer5 { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer5 { +impl ::re_types_core::Component for AffixFuzzer5 { #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer5") } } @@ -168,9 +134,43 @@ impl ::re_types_core::Loggable for AffixFuzzer5 { } } -impl ::re_types_core::Component for AffixFuzzer5 { +impl>> From for AffixFuzzer5 { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow> for AffixFuzzer5 { + #[inline] + fn borrow(&self) -> &Option { + &self.0 + } +} + +impl std::ops::Deref for AffixFuzzer5 { + type Target = Option; + + #[inline] + fn deref(&self) -> &Option { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer5 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer5".into() + fn deref_mut(&mut self) -> &mut Option { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer5 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer6.rs b/crates/store/re_types/src/testing/components/affix_fuzzer6.rs index f682a2f627ea3..5476733b4b420 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer6.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer6.rs @@ -13,52 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer6(pub Option); -impl ::re_types_core::SizeBytes for AffixFuzzer6 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl>> From for AffixFuzzer6 { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow> for AffixFuzzer6 { - #[inline] - fn borrow(&self) -> &Option { - &self.0 - } -} - -impl std::ops::Deref for AffixFuzzer6 { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer6 { +impl ::re_types_core::Component for AffixFuzzer6 { #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer6") } } @@ -168,9 +134,43 @@ impl ::re_types_core::Loggable for AffixFuzzer6 { } } -impl ::re_types_core::Component for AffixFuzzer6 { +impl>> From for AffixFuzzer6 { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow> for AffixFuzzer6 { + #[inline] + fn borrow(&self) -> &Option { + &self.0 + } +} + +impl std::ops::Deref for AffixFuzzer6 { + type Target = Option; + + #[inline] + fn deref(&self) -> &Option { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer6 { #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer6".into() + fn deref_mut(&mut self) -> &mut Option { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer6 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer7.rs b/crates/store/re_types/src/testing/components/affix_fuzzer7.rs index 7bfb69f49e2cd..bc8f53924dc95 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer7.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer7.rs @@ -13,31 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer7(pub Option>); -impl ::re_types_core::SizeBytes for AffixFuzzer7 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - +impl ::re_types_core::Component for AffixFuzzer7 { #[inline] - fn is_pod() -> bool { - >>::is_pod() - } -} - -impl, T: IntoIterator> From> - for AffixFuzzer7 -{ - fn from(v: Option) -> Self { - Self(v.map(|v| v.into_iter().map(|v| v.into()).collect())) + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer7") } } @@ -179,9 +166,22 @@ impl ::re_types_core::Loggable for AffixFuzzer7 { } } -impl ::re_types_core::Component for AffixFuzzer7 { +impl, T: IntoIterator> From> + for AffixFuzzer7 +{ + fn from(v: Option) -> Self { + Self(v.map(|v| v.into_iter().map(|v| v.into()).collect())) + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer7 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer7".into() + fn is_pod() -> bool { + >>::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer8.rs b/crates/store/re_types/src/testing/components/affix_fuzzer8.rs index 18c136749626c..5641a9d145e43 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer8.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer8.rs @@ -13,53 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer8(pub Option); -impl ::re_types_core::SizeBytes for AffixFuzzer8 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl From> for AffixFuzzer8 { - #[inline] - fn from(single_float_optional: Option) -> Self { - Self(single_float_optional) - } -} - -impl From for Option { - #[inline] - fn from(value: AffixFuzzer8) -> Self { - value.0 - } -} - -impl std::ops::Deref for AffixFuzzer8 { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer8 { +impl ::re_types_core::Component for AffixFuzzer8 { #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer8") } } @@ -142,9 +107,44 @@ impl ::re_types_core::Loggable for AffixFuzzer8 { } } -impl ::re_types_core::Component for AffixFuzzer8 { +impl From> for AffixFuzzer8 { + #[inline] + fn from(single_float_optional: Option) -> Self { + Self(single_float_optional) + } +} + +impl From for Option { + #[inline] + fn from(value: AffixFuzzer8) -> Self { + value.0 + } +} + +impl std::ops::Deref for AffixFuzzer8 { + type Target = Option; + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer8".into() + fn deref(&self) -> &Option { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer8 { + #[inline] + fn deref_mut(&mut self) -> &mut Option { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer8 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() } } diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer9.rs b/crates/store/re_types/src/testing/components/affix_fuzzer9.rs index fe012f10e97db..8fc0edc62ef4f 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer9.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer9.rs @@ -13,53 +13,18 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct AffixFuzzer9(pub ::re_types_core::ArrowString); -impl ::re_types_core::SizeBytes for AffixFuzzer9 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <::re_types_core::ArrowString>::is_pod() - } -} - -impl From<::re_types_core::ArrowString> for AffixFuzzer9 { - #[inline] - fn from(single_string_required: ::re_types_core::ArrowString) -> Self { - Self(single_string_required) - } -} - -impl From for ::re_types_core::ArrowString { - #[inline] - fn from(value: AffixFuzzer9) -> Self { - value.0 - } -} - -impl std::ops::Deref for AffixFuzzer9 { - type Target = ::re_types_core::ArrowString; - - #[inline] - fn deref(&self) -> &::re_types_core::ArrowString { - &self.0 - } -} - -impl std::ops::DerefMut for AffixFuzzer9 { +impl ::re_types_core::Component for AffixFuzzer9 { #[inline] - fn deref_mut(&mut self) -> &mut ::re_types_core::ArrowString { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.testing.components.AffixFuzzer9") } } @@ -176,9 +141,44 @@ impl ::re_types_core::Loggable for AffixFuzzer9 { } } -impl ::re_types_core::Component for AffixFuzzer9 { +impl From<::re_types_core::ArrowString> for AffixFuzzer9 { + #[inline] + fn from(single_string_required: ::re_types_core::ArrowString) -> Self { + Self(single_string_required) + } +} + +impl From for ::re_types_core::ArrowString { + #[inline] + fn from(value: AffixFuzzer9) -> Self { + value.0 + } +} + +impl std::ops::Deref for AffixFuzzer9 { + type Target = ::re_types_core::ArrowString; + #[inline] - fn name() -> ComponentName { - "rerun.testing.components.AffixFuzzer9".into() + fn deref(&self) -> &::re_types_core::ArrowString { + &self.0 + } +} + +impl std::ops::DerefMut for AffixFuzzer9 { + #[inline] + fn deref_mut(&mut self) -> &mut ::re_types_core::ArrowString { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer9 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <::re_types_core::ArrowString>::is_pod() } } diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer1.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer1.rs index ba2d2c431c383..bbef2d0212c33 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer1.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer1.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] @@ -31,34 +31,6 @@ pub struct AffixFuzzer1 { pub from_parent: Option, } -impl ::re_types_core::SizeBytes for AffixFuzzer1 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.single_float_optional.heap_size_bytes() - + self.single_string_required.heap_size_bytes() - + self.single_string_optional.heap_size_bytes() - + self.many_floats_optional.heap_size_bytes() - + self.many_strings_required.heap_size_bytes() - + self.many_strings_optional.heap_size_bytes() - + self.flattened_scalar.heap_size_bytes() - + self.almost_flattened_scalar.heap_size_bytes() - + self.from_parent.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && <::re_types_core::ArrowString>::is_pod() - && >::is_pod() - && >>::is_pod() - && >::is_pod() - && >>::is_pod() - && ::is_pod() - && ::is_pod() - && >::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(AffixFuzzer1); impl ::re_types_core::Loggable for AffixFuzzer1 { @@ -1099,3 +1071,31 @@ impl ::re_types_core::Loggable for AffixFuzzer1 { }) } } + +impl ::re_types_core::SizeBytes for AffixFuzzer1 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.single_float_optional.heap_size_bytes() + + self.single_string_required.heap_size_bytes() + + self.single_string_optional.heap_size_bytes() + + self.many_floats_optional.heap_size_bytes() + + self.many_strings_required.heap_size_bytes() + + self.many_strings_optional.heap_size_bytes() + + self.flattened_scalar.heap_size_bytes() + + self.almost_flattened_scalar.heap_size_bytes() + + self.from_parent.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && <::re_types_core::ArrowString>::is_pod() + && >::is_pod() + && >>::is_pod() + && >::is_pod() + && >>::is_pod() + && ::is_pod() + && ::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer2.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer2.rs index 01d1dab25abce..a78633c836039 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer2.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer2.rs @@ -13,40 +13,14 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] pub struct AffixFuzzer2(pub Option); -impl ::re_types_core::SizeBytes for AffixFuzzer2 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl From> for AffixFuzzer2 { - #[inline] - fn from(single_float_optional: Option) -> Self { - Self(single_float_optional) - } -} - -impl From for Option { - #[inline] - fn from(value: AffixFuzzer2) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(AffixFuzzer2); impl ::re_types_core::Loggable for AffixFuzzer2 { @@ -125,3 +99,29 @@ impl ::re_types_core::Loggable for AffixFuzzer2 { .with_context("rerun.testing.datatypes.AffixFuzzer2")?) } } + +impl From> for AffixFuzzer2 { + #[inline] + fn from(single_float_optional: Option) -> Self { + Self(single_float_optional) + } +} + +impl From for Option { + #[inline] + fn from(value: AffixFuzzer2) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer2 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer20.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer20.rs index 487260e2bc0b9..5d7be315f7a2b 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer20.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer20.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, Eq, PartialEq)] @@ -24,19 +24,6 @@ pub struct AffixFuzzer20 { pub s: crate::testing::datatypes::StringComponent, } -impl ::re_types_core::SizeBytes for AffixFuzzer20 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.p.heap_size_bytes() + self.s.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(AffixFuzzer20); impl ::re_types_core::Loggable for AffixFuzzer20 { @@ -288,3 +275,16 @@ impl ::re_types_core::Loggable for AffixFuzzer20 { }) } } + +impl ::re_types_core::SizeBytes for AffixFuzzer20 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.p.heap_size_bytes() + self.s.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && ::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer21.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer21.rs index e24e91edb5f6b..169e91c8ae8f0 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer21.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer21.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] @@ -24,18 +24,6 @@ pub struct AffixFuzzer21 { pub many_halves: ::re_types_core::ArrowBuffer, } -impl ::re_types_core::SizeBytes for AffixFuzzer21 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.single_half.heap_size_bytes() + self.many_halves.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && <::re_types_core::ArrowBuffer>::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(AffixFuzzer21); impl ::re_types_core::Loggable for AffixFuzzer21 { @@ -316,3 +304,15 @@ impl ::re_types_core::Loggable for AffixFuzzer21 { }) } } + +impl ::re_types_core::SizeBytes for AffixFuzzer21 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.single_half.heap_size_bytes() + self.many_halves.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && <::re_types_core::ArrowBuffer>::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer22.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer22.rs index 213207901dfdc..5f3ec72280265 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer22.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer22.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq, Eq)] @@ -23,32 +23,6 @@ pub struct AffixFuzzer22 { pub fixed_sized_native: [u8; 4usize], } -impl ::re_types_core::SizeBytes for AffixFuzzer22 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.fixed_sized_native.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <[u8; 4usize]>::is_pod() - } -} - -impl From<[u8; 4usize]> for AffixFuzzer22 { - #[inline] - fn from(fixed_sized_native: [u8; 4usize]) -> Self { - Self { fixed_sized_native } - } -} - -impl From for [u8; 4usize] { - #[inline] - fn from(value: AffixFuzzer22) -> Self { - value.fixed_sized_native - } -} - ::re_types_core::macros::impl_into_cow!(AffixFuzzer22); impl ::re_types_core::Loggable for AffixFuzzer22 { @@ -284,3 +258,29 @@ impl ::re_types_core::Loggable for AffixFuzzer22 { }) } } + +impl From<[u8; 4usize]> for AffixFuzzer22 { + #[inline] + fn from(fixed_sized_native: [u8; 4usize]) -> Self { + Self { fixed_sized_native } + } +} + +impl From for [u8; 4usize] { + #[inline] + fn from(value: AffixFuzzer22) -> Self { + value.fixed_sized_native + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer22 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.fixed_sized_native.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <[u8; 4usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs index cfd03c3220f80..57bcb20fe8b61 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, PartialEq)] @@ -26,26 +26,6 @@ pub enum AffixFuzzer3 { EmptyVariant, } -impl ::re_types_core::SizeBytes for AffixFuzzer3 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - #![allow(clippy::match_same_arms)] - match self { - Self::Degrees(v) => v.heap_size_bytes(), - Self::Craziness(v) => v.heap_size_bytes(), - Self::FixedSizeShenanigans(v) => v.heap_size_bytes(), - Self::EmptyVariant => 0, - } - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && <[f32; 3usize]>::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(AffixFuzzer3); impl ::re_types_core::Loggable for AffixFuzzer3 { @@ -578,3 +558,23 @@ impl ::re_types_core::Loggable for AffixFuzzer3 { }) } } + +impl ::re_types_core::SizeBytes for AffixFuzzer3 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + #![allow(clippy::match_same_arms)] + match self { + Self::Degrees(v) => v.heap_size_bytes(), + Self::Craziness(v) => v.heap_size_bytes(), + Self::FixedSizeShenanigans(v) => v.heap_size_bytes(), + Self::EmptyVariant => 0, + } + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && <[f32; 3usize]>::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs index fc7b470f5272b..2e8a283e51dcd 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, PartialEq)] @@ -24,23 +24,6 @@ pub enum AffixFuzzer4 { ManyRequired(Vec), } -impl ::re_types_core::SizeBytes for AffixFuzzer4 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - #![allow(clippy::match_same_arms)] - match self { - Self::SingleRequired(v) => v.heap_size_bytes(), - Self::ManyRequired(v) => v.heap_size_bytes(), - } - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(AffixFuzzer4); impl ::re_types_core::Loggable for AffixFuzzer4 { @@ -388,3 +371,20 @@ impl ::re_types_core::Loggable for AffixFuzzer4 { }) } } + +impl ::re_types_core::SizeBytes for AffixFuzzer4 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + #![allow(clippy::match_same_arms)] + match self { + Self::SingleRequired(v) => v.heap_size_bytes(), + Self::ManyRequired(v) => v.heap_size_bytes(), + } + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer5.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer5.rs index 5c040392f301c..22dcfdb3ae403 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer5.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer5.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] @@ -23,49 +23,6 @@ pub struct AffixFuzzer5 { pub single_optional_union: Option, } -impl ::re_types_core::SizeBytes for AffixFuzzer5 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.single_optional_union.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl>> From for AffixFuzzer5 { - fn from(v: T) -> Self { - Self { - single_optional_union: v.into(), - } - } -} - -impl std::borrow::Borrow> for AffixFuzzer5 { - #[inline] - fn borrow(&self) -> &Option { - &self.single_optional_union - } -} - -impl std::ops::Deref for AffixFuzzer5 { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.single_optional_union - } -} - -impl std::ops::DerefMut for AffixFuzzer5 { - #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.single_optional_union - } -} - ::re_types_core::macros::impl_into_cow!(AffixFuzzer5); impl ::re_types_core::Loggable for AffixFuzzer5 { @@ -202,3 +159,46 @@ impl ::re_types_core::Loggable for AffixFuzzer5 { }) } } + +impl>> From for AffixFuzzer5 { + fn from(v: T) -> Self { + Self { + single_optional_union: v.into(), + } + } +} + +impl std::borrow::Borrow> for AffixFuzzer5 { + #[inline] + fn borrow(&self) -> &Option { + &self.single_optional_union + } +} + +impl std::ops::Deref for AffixFuzzer5 { + type Target = Option; + + #[inline] + fn deref(&self) -> &Option { + &self.single_optional_union + } +} + +impl std::ops::DerefMut for AffixFuzzer5 { + #[inline] + fn deref_mut(&mut self) -> &mut Option { + &mut self.single_optional_union + } +} + +impl ::re_types_core::SizeBytes for AffixFuzzer5 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.single_optional_union.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/enum_test.rs b/crates/store/re_types/src/testing/datatypes/enum_test.rs index 8f30d669d996d..561dc7fe69ea0 100644 --- a/crates/store/re_types/src/testing/datatypes/enum_test.rs +++ b/crates/store/re_types/src/testing/datatypes/enum_test.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A test of the enum type. @@ -43,57 +43,6 @@ pub enum EnumTest { Back = 6, } -impl ::re_types_core::reflection::Enum for EnumTest { - #[inline] - fn variants() -> &'static [Self] { - &[ - Self::Up, - Self::Down, - Self::Right, - Self::Left, - Self::Forward, - Self::Back, - ] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Up => "Great film.", - Self::Down => "Feeling blue.", - Self::Right => "Correct.", - Self::Left => "It's what's remaining.", - Self::Forward => "It's the only way to go.", - Self::Back => "Baby's got it.", - } - } -} - -impl ::re_types_core::SizeBytes for EnumTest { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for EnumTest { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Up => write!(f, "Up"), - Self::Down => write!(f, "Down"), - Self::Right => write!(f, "Right"), - Self::Left => write!(f, "Left"), - Self::Forward => write!(f, "Forward"), - Self::Back => write!(f, "Back"), - } - } -} - ::re_types_core::macros::impl_into_cow!(EnumTest); impl ::re_types_core::Loggable for EnumTest { @@ -183,3 +132,54 @@ impl ::re_types_core::Loggable for EnumTest { .with_context("rerun.testing.datatypes.EnumTest")?) } } + +impl std::fmt::Display for EnumTest { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Up => write!(f, "Up"), + Self::Down => write!(f, "Down"), + Self::Right => write!(f, "Right"), + Self::Left => write!(f, "Left"), + Self::Forward => write!(f, "Forward"), + Self::Back => write!(f, "Back"), + } + } +} + +impl ::re_types_core::reflection::Enum for EnumTest { + #[inline] + fn variants() -> &'static [Self] { + &[ + Self::Up, + Self::Down, + Self::Right, + Self::Left, + Self::Forward, + Self::Back, + ] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::Up => "Great film.", + Self::Down => "Feeling blue.", + Self::Right => "Correct.", + Self::Left => "It's what's remaining.", + Self::Forward => "It's the only way to go.", + Self::Back => "Baby's got it.", + } + } +} + +impl ::re_types_core::SizeBytes for EnumTest { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true + } +} diff --git a/crates/store/re_types/src/testing/datatypes/flattened_scalar.rs b/crates/store/re_types/src/testing/datatypes/flattened_scalar.rs index 8ab89f869d30d..6ab886e28bbe2 100644 --- a/crates/store/re_types/src/testing/datatypes/flattened_scalar.rs +++ b/crates/store/re_types/src/testing/datatypes/flattened_scalar.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq)] @@ -23,32 +23,6 @@ pub struct FlattenedScalar { pub value: f32, } -impl ::re_types_core::SizeBytes for FlattenedScalar { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.value.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for FlattenedScalar { - #[inline] - fn from(value: f32) -> Self { - Self { value } - } -} - -impl From for f32 { - #[inline] - fn from(value: FlattenedScalar) -> Self { - value.value - } -} - ::re_types_core::macros::impl_into_cow!(FlattenedScalar); impl ::re_types_core::Loggable for FlattenedScalar { @@ -191,3 +165,29 @@ impl ::re_types_core::Loggable for FlattenedScalar { }) } } + +impl From for FlattenedScalar { + #[inline] + fn from(value: f32) -> Self { + Self { value } + } +} + +impl From for f32 { + #[inline] + fn from(value: FlattenedScalar) -> Self { + value.value + } +} + +impl ::re_types_core::SizeBytes for FlattenedScalar { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.value.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/multi_enum.rs b/crates/store/re_types/src/testing/datatypes/multi_enum.rs index 7140e76ec8a4f..465eeedc63d27 100644 --- a/crates/store/re_types/src/testing/datatypes/multi_enum.rs +++ b/crates/store/re_types/src/testing/datatypes/multi_enum.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, PartialEq, Eq)] @@ -27,19 +27,6 @@ pub struct MultiEnum { pub value2: Option, } -impl ::re_types_core::SizeBytes for MultiEnum { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.value1.heap_size_bytes() + self.value2.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - } -} - ::re_types_core::macros::impl_into_cow!(MultiEnum); impl ::re_types_core::Loggable for MultiEnum { @@ -221,3 +208,16 @@ impl ::re_types_core::Loggable for MultiEnum { }) } } + +impl ::re_types_core::SizeBytes for MultiEnum { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.value1.heap_size_bytes() + self.value2.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/primitive_component.rs b/crates/store/re_types/src/testing/datatypes/primitive_component.rs index 885db4cb2b1dc..222b2e5aa959c 100644 --- a/crates/store/re_types/src/testing/datatypes/primitive_component.rs +++ b/crates/store/re_types/src/testing/datatypes/primitive_component.rs @@ -13,41 +13,15 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, Eq, PartialEq)] #[repr(transparent)] pub struct PrimitiveComponent(pub u32); -impl ::re_types_core::SizeBytes for PrimitiveComponent { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for PrimitiveComponent { - #[inline] - fn from(value: u32) -> Self { - Self(value) - } -} - -impl From for u32 { - #[inline] - fn from(value: PrimitiveComponent) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(PrimitiveComponent); impl ::re_types_core::Loggable for PrimitiveComponent { @@ -158,3 +132,29 @@ impl ::re_types_core::Loggable for PrimitiveComponent { }) } } + +impl From for PrimitiveComponent { + #[inline] + fn from(value: u32) -> Self { + Self(value) + } +} + +impl From for u32 { + #[inline] + fn from(value: PrimitiveComponent) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for PrimitiveComponent { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/string_component.rs b/crates/store/re_types/src/testing/datatypes/string_component.rs index b001198a7d2ed..281c53588e9c3 100644 --- a/crates/store/re_types/src/testing/datatypes/string_component.rs +++ b/crates/store/re_types/src/testing/datatypes/string_component.rs @@ -13,41 +13,15 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug, Default, Eq, PartialEq)] #[repr(transparent)] pub struct StringComponent(pub ::re_types_core::ArrowString); -impl ::re_types_core::SizeBytes for StringComponent { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - <::re_types_core::ArrowString>::is_pod() - } -} - -impl From<::re_types_core::ArrowString> for StringComponent { - #[inline] - fn from(value: ::re_types_core::ArrowString) -> Self { - Self(value) - } -} - -impl From for ::re_types_core::ArrowString { - #[inline] - fn from(value: StringComponent) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(StringComponent); impl ::re_types_core::Loggable for StringComponent { @@ -160,3 +134,29 @@ impl ::re_types_core::Loggable for StringComponent { .with_context("rerun.testing.datatypes.StringComponent")?) } } + +impl From<::re_types_core::ArrowString> for StringComponent { + #[inline] + fn from(value: ::re_types_core::ArrowString) -> Self { + Self(value) + } +} + +impl From for ::re_types_core::ArrowString { + #[inline] + fn from(value: StringComponent) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for StringComponent { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + <::re_types_core::ArrowString>::is_pod() + } +} diff --git a/crates/store/re_types/src/testing/datatypes/valued_enum.rs b/crates/store/re_types/src/testing/datatypes/valued_enum.rs index 3761179f8bcf2..36e91a0c956cd 100644 --- a/crates/store/re_types/src/testing/datatypes/valued_enum.rs +++ b/crates/store/re_types/src/testing/datatypes/valued_enum.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A test of an enumate with specified values. @@ -36,46 +36,6 @@ pub enum ValuedEnum { TheAnswer = 42, } -impl ::re_types_core::reflection::Enum for ValuedEnum { - #[inline] - fn variants() -> &'static [Self] { - &[Self::One, Self::Two, Self::Three, Self::TheAnswer] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::One => "One.", - Self::Two => "Two.", - Self::Three => "Three.", - Self::TheAnswer => "The answer to life, the universe, and everything.", - } - } -} - -impl ::re_types_core::SizeBytes for ValuedEnum { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for ValuedEnum { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::One => write!(f, "One"), - Self::Two => write!(f, "Two"), - Self::Three => write!(f, "Three"), - Self::TheAnswer => write!(f, "TheAnswer"), - } - } -} - ::re_types_core::macros::impl_into_cow!(ValuedEnum); impl ::re_types_core::Loggable for ValuedEnum { @@ -163,3 +123,43 @@ impl ::re_types_core::Loggable for ValuedEnum { .with_context("rerun.testing.datatypes.ValuedEnum")?) } } + +impl std::fmt::Display for ValuedEnum { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::One => write!(f, "One"), + Self::Two => write!(f, "Two"), + Self::Three => write!(f, "Three"), + Self::TheAnswer => write!(f, "TheAnswer"), + } + } +} + +impl ::re_types_core::reflection::Enum for ValuedEnum { + #[inline] + fn variants() -> &'static [Self] { + &[Self::One, Self::Two, Self::Three, Self::TheAnswer] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::One => "One.", + Self::Two => "Two.", + Self::Three => "Three.", + Self::TheAnswer => "The answer to life, the universe, and everything.", + } + } +} + +impl ::re_types_core::SizeBytes for ValuedEnum { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true + } +} diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs index e7aec84d119a0..9de13a7355522 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The description of a container. @@ -62,65 +62,113 @@ pub struct ContainerBlueprint { pub grid_columns: Option, } -impl ::re_types_core::SizeBytes for ContainerBlueprint { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.container_kind.heap_size_bytes() - + self.display_name.heap_size_bytes() - + self.contents.heap_size_bytes() - + self.col_shares.heap_size_bytes() - + self.row_shares.heap_size_bytes() - + self.active_tab.heap_size_bytes() - + self.visible.heap_size_bytes() - + self.grid_columns.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && >::is_pod() - && >>::is_pod() - && >>::is_pod() - && >>::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.ContainerKind".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.ContainerKind".into(), + archetype_field_name: Some("container_kind".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new( - || ["rerun.blueprint.components.ContainerBlueprintIndicator".into()], - ); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "ContainerBlueprintIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.Name".into(), - "rerun.blueprint.components.IncludedContent".into(), - "rerun.blueprint.components.ColumnShare".into(), - "rerun.blueprint.components.RowShare".into(), - "rerun.blueprint.components.ActiveTab".into(), - "rerun.blueprint.components.Visible".into(), - "rerun.blueprint.components.GridColumns".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.components.Name".into(), + archetype_field_name: Some("display_name".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.IncludedContent".into(), + archetype_field_name: Some("contents".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.ColumnShare".into(), + archetype_field_name: Some("col_shares".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.RowShare".into(), + archetype_field_name: Some("row_shares".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.ActiveTab".into(), + archetype_field_name: Some("active_tab".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.Visible".into(), + archetype_field_name: Some("visible".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.GridColumns".into(), + archetype_field_name: Some("grid_columns".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.ContainerKind".into(), - "rerun.blueprint.components.ContainerBlueprintIndicator".into(), - "rerun.components.Name".into(), - "rerun.blueprint.components.IncludedContent".into(), - "rerun.blueprint.components.ColumnShare".into(), - "rerun.blueprint.components.RowShare".into(), - "rerun.blueprint.components.ActiveTab".into(), - "rerun.blueprint.components.Visible".into(), - "rerun.blueprint.components.GridColumns".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.ContainerKind".into(), + archetype_field_name: Some("container_kind".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "ContainerBlueprintIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.components.Name".into(), + archetype_field_name: Some("display_name".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.IncludedContent".into(), + archetype_field_name: Some("contents".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.ColumnShare".into(), + archetype_field_name: Some("col_shares".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.RowShare".into(), + archetype_field_name: Some("row_shares".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.ActiveTab".into(), + archetype_field_name: Some("active_tab".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.Visible".into(), + archetype_field_name: Some("visible".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + component_name: "rerun.blueprint.components.GridColumns".into(), + archetype_field_name: Some("grid_columns".into()), + }, ] }); @@ -149,26 +197,26 @@ impl ::re_types_core::Archetype for ContainerBlueprint { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: ContainerBlueprintIndicator = ContainerBlueprintIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -292,28 +340,102 @@ impl ::re_types_core::AsComponents for ContainerBlueprint { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - Some((&self.container_kind as &dyn ComponentBatch).into()), - self.display_name + (Some(&self.container_kind as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some( + "rerun.blueprint.archetypes.ContainerBlueprint".into(), + ), + archetype_field_name: Some(("container_kind").into()), + component_name: ("rerun.blueprint.components.ContainerKind").into(), + }), + } + }), + (self + .display_name .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.contents + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + archetype_field_name: Some(("display_name").into()), + component_name: ("rerun.components.Name").into(), + }), + }), + (self + .contents .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.col_shares + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + archetype_field_name: Some(("contents").into()), + component_name: ("rerun.blueprint.components.IncludedContent").into(), + }), + }), + (self + .col_shares .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.row_shares + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + archetype_field_name: Some(("col_shares").into()), + component_name: ("rerun.blueprint.components.ColumnShare").into(), + }), + }), + (self + .row_shares .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.active_tab + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + archetype_field_name: Some(("row_shares").into()), + component_name: ("rerun.blueprint.components.RowShare").into(), + }), + }), + (self + .active_tab .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.visible + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + archetype_field_name: Some(("active_tab").into()), + component_name: ("rerun.blueprint.components.ActiveTab").into(), + }), + }), + (self + .visible .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.grid_columns + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + archetype_field_name: Some(("visible").into()), + component_name: ("rerun.blueprint.components.Visible").into(), + }), + }), + (self + .grid_columns .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), + archetype_field_name: Some(("grid_columns").into()), + component_name: ("rerun.blueprint.components.GridColumns").into(), + }), + }), ] .into_iter() .flatten() @@ -422,3 +544,29 @@ impl ContainerBlueprint { self } } + +impl ::re_types_core::SizeBytes for ContainerBlueprint { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.container_kind.heap_size_bytes() + + self.display_name.heap_size_bytes() + + self.contents.heap_size_bytes() + + self.col_shares.heap_size_bytes() + + self.row_shares.heap_size_bytes() + + self.active_tab.heap_size_bytes() + + self.visible.heap_size_bytes() + + self.grid_columns.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && >::is_pod() + && >>::is_pod() + && >>::is_pod() + && >>::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs index 10cefb0672989..ffd933b82af33 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Shared state for the 3 collapsible panels. @@ -24,32 +24,40 @@ pub struct PanelBlueprint { pub state: Option, } -impl ::re_types_core::SizeBytes for PanelBlueprint { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.state.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.PanelBlueprintIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PanelBlueprint".into()), + component_name: "PanelBlueprintIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.PanelState".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PanelBlueprint".into()), + component_name: "rerun.blueprint.components.PanelState".into(), + archetype_field_name: Some("state".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.PanelBlueprintIndicator".into(), - "rerun.blueprint.components.PanelState".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PanelBlueprint".into()), + component_name: "PanelBlueprintIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PanelBlueprint".into()), + component_name: "rerun.blueprint.components.PanelState".into(), + archetype_field_name: Some("state".into()), + }, ] }); @@ -77,26 +85,26 @@ impl ::re_types_core::Archetype for PanelBlueprint { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: PanelBlueprintIndicator = PanelBlueprintIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -130,9 +138,18 @@ impl ::re_types_core::AsComponents for PanelBlueprint { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.state + (self + .state .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.PanelBlueprint".into()), + archetype_field_name: Some(("state").into()), + component_name: ("rerun.blueprint.components.PanelState").into(), + }), + }), ] .into_iter() .flatten() @@ -158,3 +175,15 @@ impl PanelBlueprint { self } } + +impl ::re_types_core::SizeBytes for PanelBlueprint { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.state.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + } +} diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs index 04a55c4771dac..2907b53174cdc 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The top-level description of the viewport. @@ -50,52 +50,82 @@ pub struct ViewportBlueprint { Option>, } -impl ::re_types_core::SizeBytes for ViewportBlueprint { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.root_container.heap_size_bytes() - + self.maximized.heap_size_bytes() - + self.auto_layout.heap_size_bytes() - + self.auto_space_views.heap_size_bytes() - + self.past_viewer_recommendations.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() - && >>::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.ViewportBlueprintIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "ViewportBlueprintIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.RootContainer".into(), - "rerun.blueprint.components.SpaceViewMaximized".into(), - "rerun.blueprint.components.AutoLayout".into(), - "rerun.blueprint.components.AutoSpaceViews".into(), - "rerun.blueprint.components.ViewerRecommendationHash".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.RootContainer".into(), + archetype_field_name: Some("root_container".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.SpaceViewMaximized".into(), + archetype_field_name: Some("maximized".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.AutoLayout".into(), + archetype_field_name: Some("auto_layout".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.AutoSpaceViews".into(), + archetype_field_name: Some("auto_space_views".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.ViewerRecommendationHash".into(), + archetype_field_name: Some("past_viewer_recommendations".into()), + }, ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.ViewportBlueprintIndicator".into(), - "rerun.blueprint.components.RootContainer".into(), - "rerun.blueprint.components.SpaceViewMaximized".into(), - "rerun.blueprint.components.AutoLayout".into(), - "rerun.blueprint.components.AutoSpaceViews".into(), - "rerun.blueprint.components.ViewerRecommendationHash".into(), + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "ViewportBlueprintIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.RootContainer".into(), + archetype_field_name: Some("root_container".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.SpaceViewMaximized".into(), + archetype_field_name: Some("maximized".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.AutoLayout".into(), + archetype_field_name: Some("auto_layout".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.AutoSpaceViews".into(), + archetype_field_name: Some("auto_space_views".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + component_name: "rerun.blueprint.components.ViewerRecommendationHash".into(), + archetype_field_name: Some("past_viewer_recommendations".into()), + }, ] }); @@ -123,26 +153,26 @@ impl ::re_types_core::Archetype for ViewportBlueprint { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: ViewportBlueprintIndicator = ViewportBlueprintIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -231,21 +261,66 @@ impl ::re_types_core::AsComponents for ViewportBlueprint { use ::re_types_core::Archetype as _; [ Some(Self::indicator()), - self.root_container + (self + .root_container .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.maximized + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + archetype_field_name: Some(("root_container").into()), + component_name: ("rerun.blueprint.components.RootContainer").into(), + }), + }), + (self + .maximized .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.auto_layout + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + archetype_field_name: Some(("maximized").into()), + component_name: ("rerun.blueprint.components.SpaceViewMaximized").into(), + }), + }), + (self + .auto_layout .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.auto_space_views + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + archetype_field_name: Some(("auto_layout").into()), + component_name: ("rerun.blueprint.components.AutoLayout").into(), + }), + }), + (self + .auto_space_views .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.past_viewer_recommendations + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + archetype_field_name: Some(("auto_space_views").into()), + component_name: ("rerun.blueprint.components.AutoSpaceViews").into(), + }), + }), + (self + .past_viewer_recommendations .as_ref() - .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), + .map(|comp_batch| (comp_batch as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), + archetype_field_name: Some(("past_viewer_recommendations").into()), + component_name: ("rerun.blueprint.components.ViewerRecommendationHash").into(), + }), + }), ] .into_iter() .flatten() @@ -337,3 +412,23 @@ impl ViewportBlueprint { self } } + +impl ::re_types_core::SizeBytes for ViewportBlueprint { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.root_container.heap_size_bytes() + + self.maximized.heap_size_bytes() + + self.auto_layout.heap_size_bytes() + + self.auto_space_views.heap_size_bytes() + + self.past_viewer_recommendations.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >>::is_pod() + } +} diff --git a/crates/store/re_types_blueprint/src/blueprint/components/auto_layout.rs b/crates/store/re_types_blueprint/src/blueprint/components/auto_layout.rs index e76dc9edd1552..d653798499185 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/auto_layout.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/auto_layout.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Whether the viewport layout is determined automatically. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct AutoLayout(pub crate::datatypes::Bool); -impl ::re_types_core::SizeBytes for AutoLayout { +impl ::re_types_core::Component for AutoLayout { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.AutoLayout") } +} +::re_types_core::macros::impl_into_cow!(AutoLayout); + +impl ::re_types_core::Loggable for AutoLayout { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for AutoLayout { } } -::re_types_core::macros::impl_into_cow!(AutoLayout); - -impl ::re_types_core::Loggable for AutoLayout { +impl ::re_types_core::SizeBytes for AutoLayout { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AutoLayout { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.AutoLayout".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types_blueprint/src/blueprint/components/auto_space_views.rs b/crates/store/re_types_blueprint/src/blueprint/components/auto_space_views.rs index b23a9816b6806..e0eabdd933ea3 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/auto_space_views.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/auto_space_views.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Whether or not space views should be created automatically. @@ -23,15 +23,43 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct AutoSpaceViews(pub crate::datatypes::Bool); -impl ::re_types_core::SizeBytes for AutoSpaceViews { +impl ::re_types_core::Component for AutoSpaceViews { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.AutoSpaceViews") } +} +::re_types_core::macros::impl_into_cow!(AutoSpaceViews); + +impl ::re_types_core::Loggable for AutoSpaceViews { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -64,42 +92,14 @@ impl std::ops::DerefMut for AutoSpaceViews { } } -::re_types_core::macros::impl_into_cow!(AutoSpaceViews); - -impl ::re_types_core::Loggable for AutoSpaceViews { +impl ::re_types_core::SizeBytes for AutoSpaceViews { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for AutoSpaceViews { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.AutoSpaceViews".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types_blueprint/src/blueprint/components/container_kind.rs b/crates/store/re_types_blueprint/src/blueprint/components/container_kind.rs index a870a7b3184eb..2b3dee254ccf3 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/container_kind.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/container_kind.rs @@ -14,9 +14,9 @@ #![allow(non_camel_case_types)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The kind of a blueprint container (tabs, grid, …). @@ -37,43 +37,10 @@ pub enum ContainerKind { Grid = 4, } -impl ::re_types_core::reflection::Enum for ContainerKind { - #[inline] - fn variants() -> &'static [Self] { - &[Self::Tabs, Self::Horizontal, Self::Vertical, Self::Grid] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Tabs => "Put children in separate tabs", - Self::Horizontal => "Order the children left to right", - Self::Vertical => "Order the children top to bottom", - Self::Grid => "Organize children in a grid layout", - } - } -} - -impl ::re_types_core::SizeBytes for ContainerKind { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - +impl ::re_types_core::Component for ContainerKind { #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for ContainerKind { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Tabs => write!(f, "Tabs"), - Self::Horizontal => write!(f, "Horizontal"), - Self::Vertical => write!(f, "Vertical"), - Self::Grid => write!(f, "Grid"), - } + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ContainerKind") } } @@ -165,9 +132,42 @@ impl ::re_types_core::Loggable for ContainerKind { } } -impl ::re_types_core::Component for ContainerKind { +impl std::fmt::Display for ContainerKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Tabs => write!(f, "Tabs"), + Self::Horizontal => write!(f, "Horizontal"), + Self::Vertical => write!(f, "Vertical"), + Self::Grid => write!(f, "Grid"), + } + } +} + +impl ::re_types_core::reflection::Enum for ContainerKind { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.ContainerKind".into() + fn variants() -> &'static [Self] { + &[Self::Tabs, Self::Horizontal, Self::Vertical, Self::Grid] + } + + #[inline] + fn docstring_md(self) -> &'static str { + match self { + Self::Tabs => "Put children in separate tabs", + Self::Horizontal => "Order the children left to right", + Self::Vertical => "Order the children top to bottom", + Self::Grid => "Organize children in a grid layout", + } + } +} + +impl ::re_types_core::SizeBytes for ContainerKind { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true } } diff --git a/crates/store/re_types_blueprint/src/blueprint/components/grid_columns.rs b/crates/store/re_types_blueprint/src/blueprint/components/grid_columns.rs index 6d5c2cd364476..7e0f40f99b77d 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/grid_columns.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/grid_columns.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: How many columns a grid container should have. @@ -25,44 +25,10 @@ pub struct GridColumns( pub crate::datatypes::UInt32, ); -impl ::re_types_core::SizeBytes for GridColumns { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for GridColumns { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for GridColumns { - #[inline] - fn borrow(&self) -> &crate::datatypes::UInt32 { - &self.0 - } -} - -impl std::ops::Deref for GridColumns { - type Target = crate::datatypes::UInt32; - - #[inline] - fn deref(&self) -> &crate::datatypes::UInt32 { - &self.0 - } -} - -impl std::ops::DerefMut for GridColumns { +impl ::re_types_core::Component for GridColumns { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::UInt32 { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.GridColumns") } } @@ -107,9 +73,43 @@ impl ::re_types_core::Loggable for GridColumns { } } -impl ::re_types_core::Component for GridColumns { +impl> From for GridColumns { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for GridColumns { + #[inline] + fn borrow(&self) -> &crate::datatypes::UInt32 { + &self.0 + } +} + +impl std::ops::Deref for GridColumns { + type Target = crate::datatypes::UInt32; + + #[inline] + fn deref(&self) -> &crate::datatypes::UInt32 { + &self.0 + } +} + +impl std::ops::DerefMut for GridColumns { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.GridColumns".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::UInt32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for GridColumns { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types_blueprint/src/blueprint/components/root_container.rs b/crates/store/re_types_blueprint/src/blueprint/components/root_container.rs index 0c754d3403ce4..5ecddae5f9889 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/root_container.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/root_container.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The container that sits at the root of a viewport. @@ -26,44 +26,10 @@ pub struct RootContainer( pub crate::datatypes::Uuid, ); -impl ::re_types_core::SizeBytes for RootContainer { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for RootContainer { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for RootContainer { - #[inline] - fn borrow(&self) -> &crate::datatypes::Uuid { - &self.0 - } -} - -impl std::ops::Deref for RootContainer { - type Target = crate::datatypes::Uuid; - - #[inline] - fn deref(&self) -> &crate::datatypes::Uuid { - &self.0 - } -} - -impl std::ops::DerefMut for RootContainer { +impl ::re_types_core::Component for RootContainer { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Uuid { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.RootContainer") } } @@ -108,9 +74,43 @@ impl ::re_types_core::Loggable for RootContainer { } } -impl ::re_types_core::Component for RootContainer { +impl> From for RootContainer { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for RootContainer { + #[inline] + fn borrow(&self) -> &crate::datatypes::Uuid { + &self.0 + } +} + +impl std::ops::Deref for RootContainer { + type Target = crate::datatypes::Uuid; + + #[inline] + fn deref(&self) -> &crate::datatypes::Uuid { + &self.0 + } +} + +impl std::ops::DerefMut for RootContainer { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.RootContainer".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Uuid { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for RootContainer { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types_blueprint/src/blueprint/components/space_view_maximized.rs b/crates/store/re_types_blueprint/src/blueprint/components/space_view_maximized.rs index 482494005730c..2a319e7aed576 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/space_view_maximized.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/space_view_maximized.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Whether a space view is maximized. @@ -23,44 +23,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct SpaceViewMaximized(pub crate::datatypes::Uuid); -impl ::re_types_core::SizeBytes for SpaceViewMaximized { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl> From for SpaceViewMaximized { - fn from(v: T) -> Self { - Self(v.into()) - } -} - -impl std::borrow::Borrow for SpaceViewMaximized { - #[inline] - fn borrow(&self) -> &crate::datatypes::Uuid { - &self.0 - } -} - -impl std::ops::Deref for SpaceViewMaximized { - type Target = crate::datatypes::Uuid; - - #[inline] - fn deref(&self) -> &crate::datatypes::Uuid { - &self.0 - } -} - -impl std::ops::DerefMut for SpaceViewMaximized { +impl ::re_types_core::Component for SpaceViewMaximized { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Uuid { - &mut self.0 + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.SpaceViewMaximized") } } @@ -105,9 +71,43 @@ impl ::re_types_core::Loggable for SpaceViewMaximized { } } -impl ::re_types_core::Component for SpaceViewMaximized { +impl> From for SpaceViewMaximized { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for SpaceViewMaximized { + #[inline] + fn borrow(&self) -> &crate::datatypes::Uuid { + &self.0 + } +} + +impl std::ops::Deref for SpaceViewMaximized { + type Target = crate::datatypes::Uuid; + + #[inline] + fn deref(&self) -> &crate::datatypes::Uuid { + &self.0 + } +} + +impl std::ops::DerefMut for SpaceViewMaximized { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.SpaceViewMaximized".into() + fn deref_mut(&mut self) -> &mut crate::datatypes::Uuid { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for SpaceViewMaximized { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs b/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs index a5c7020c1cd1b..71d9142d0c4a8 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Override the visualizers for an entity. @@ -58,15 +58,43 @@ pub struct VisualizerOverrides( pub crate::blueprint::datatypes::Utf8List, ); -impl ::re_types_core::SizeBytes for VisualizerOverrides { +impl ::re_types_core::Component for VisualizerOverrides { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.VisualizerOverrides") } +} +::re_types_core::macros::impl_into_cow!(VisualizerOverrides); + +impl ::re_types_core::Loggable for VisualizerOverrides { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::blueprint::datatypes::Utf8List::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::blueprint::datatypes::Utf8List::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::blueprint::datatypes::Utf8List::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -99,42 +127,14 @@ impl std::ops::DerefMut for VisualizerOverrides { } } -::re_types_core::macros::impl_into_cow!(VisualizerOverrides); - -impl ::re_types_core::Loggable for VisualizerOverrides { +impl ::re_types_core::SizeBytes for VisualizerOverrides { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::blueprint::datatypes::Utf8List::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::blueprint::datatypes::Utf8List::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::blueprint::datatypes::Utf8List::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl ::re_types_core::Component for VisualizerOverrides { #[inline] - fn name() -> ComponentName { - "rerun.blueprint.components.VisualizerOverrides".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs b/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs index 0dd4a91fef63f..23cd7514328e7 100644 --- a/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs +++ b/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Datatype**: A list of strings of text, encoded as UTF-8. @@ -23,32 +23,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Utf8List(pub Vec<::re_types_core::ArrowString>); -impl ::re_types_core::SizeBytes for Utf8List { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl From> for Utf8List { - #[inline] - fn from(value: Vec<::re_types_core::ArrowString>) -> Self { - Self(value) - } -} - -impl From for Vec<::re_types_core::ArrowString> { - #[inline] - fn from(value: Utf8List) -> Self { - value.0 - } -} - ::re_types_core::macros::impl_into_cow!(Utf8List); impl ::re_types_core::Loggable for Utf8List { @@ -229,3 +203,29 @@ impl ::re_types_core::Loggable for Utf8List { .with_context("rerun.blueprint.datatypes.Utf8List")?) } } + +impl From> for Utf8List { + #[inline] + fn from(value: Vec<::re_types_core::ArrowString>) -> Self { + Self(value) + } +} + +impl From for Vec<::re_types_core::ArrowString> { + #[inline] + fn from(value: Utf8List) -> Self { + value.0 + } +} + +impl ::re_types_core::SizeBytes for Utf8List { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + } +} diff --git a/crates/store/re_types_core/src/archetype.rs b/crates/store/re_types_core/src/archetype.rs index 9a14d221ff36b..2f9d471503e23 100644 --- a/crates/store/re_types_core/src/archetype.rs +++ b/crates/store/re_types_core/src/archetype.rs @@ -1,6 +1,8 @@ +use std::borrow::Cow; + use crate::{ - ComponentBatch, ComponentName, DeserializationResult, MaybeOwnedComponentBatch, - SerializationResult, _Backtrace, + ComponentBatch, ComponentDescriptor, ComponentName, DeserializationResult, + MaybeOwnedComponentBatch, SerializationResult, _Backtrace, }; #[allow(unused_imports)] // used in docstrings @@ -40,49 +42,46 @@ pub trait Archetype { /// The fully-qualified name of this archetype, e.g. `rerun.archetypes.Points2D`. fn name() -> ArchetypeName; - /// Readable name for displaying in ui. + /// Readable name for displaying in UI. fn display_name() -> &'static str; // --- - // TODO(cmc): Should we also generate and return static IntSets? - /// Creates a [`ComponentBatch`] out of the associated [`Self::Indicator`] component. /// /// This allows for associating arbitrary indicator components with arbitrary data. /// Check out the `manual_indicator` API example to see what's possible. #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { - MaybeOwnedComponentBatch::Owned(Box::<::Indicator>::default()) + MaybeOwnedComponentBatch::new( + Box::<::Indicator>::default() as Box + ) } - /// Returns the names of all components that _must_ be provided by the user when constructing - /// this archetype. - fn required_components() -> std::borrow::Cow<'static, [ComponentName]>; + /// Returns all component descriptors that _must_ be provided by the user when constructing this archetype. + fn required_components() -> std::borrow::Cow<'static, [ComponentDescriptor]>; - /// Returns the names of all components that _should_ be provided by the user when constructing - /// this archetype. + /// Returns all component descriptors that _should_ be provided by the user when constructing this archetype. #[inline] - fn recommended_components() -> std::borrow::Cow<'static, [ComponentName]> { - std::borrow::Cow::Owned(vec![Self::indicator().name()]) + fn recommended_components() -> std::borrow::Cow<'static, [ComponentDescriptor]> { + std::borrow::Cow::Owned(vec![Self::indicator().descriptor().into_owned()]) } - /// Returns the names of all components that _may_ be provided by the user when constructing - /// this archetype. + /// Returns all component descriptors that _may_ be provided by the user when constructing this archetype. #[inline] - fn optional_components() -> std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> std::borrow::Cow<'static, [ComponentDescriptor]> { std::borrow::Cow::Borrowed(&[]) } - /// Returns the names of all components that must, should and may be provided by the user when - /// constructing this archetype. + /// Returns all component descriptors that must, should and may be provided by the user when constructing + /// this archetype. /// /// The default implementation always does the right thing, at the cost of some runtime /// allocations. - /// If you know all your components statically, you can override this method to get rid of the + /// If you know all your component descriptors statically, you can override this method to get rid of the /// extra allocations. #[inline] - fn all_components() -> std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> std::borrow::Cow<'static, [ComponentDescriptor]> { [ Self::required_components().into_owned(), Self::recommended_components().into_owned(), @@ -176,6 +175,27 @@ impl ArchetypeName { } } +impl crate::SizeBytes for ArchetypeName { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } +} + +// --- + +re_string_interner::declare_new_type!( + /// The name of an [`Archetype`]'s field, e.g. `positions`. + pub struct ArchetypeFieldName; +); + +impl crate::SizeBytes for ArchetypeFieldName { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } +} + // --- /// A generic [indicator component] that can be specialized for any [`Archetype`]. @@ -224,10 +244,15 @@ impl crate::LoggableBatch for GenericIndicatorComponent { impl crate::ComponentBatch for GenericIndicatorComponent { #[inline] - fn name(&self) -> ComponentName { - format!("{}Indicator", A::name().full_name()) - .replace("archetypes", "components") - .into() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + let component_name = + format!("{}Indicator", A::name().full_name()).replace("archetypes", "components"); + ComponentDescriptor { + archetype_name: Some(A::name()), + archetype_field_name: None, + component_name: component_name.into(), + } + .into() } } @@ -255,8 +280,8 @@ impl crate::LoggableBatch for GenericIndicatorComponentArray { impl crate::ComponentBatch for GenericIndicatorComponentArray { #[inline] - fn name(&self) -> ComponentName { - GenericIndicatorComponent::::DEFAULT.name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + ComponentDescriptor::new(GenericIndicatorComponent::::DEFAULT.name()).into() } } @@ -271,12 +296,12 @@ pub struct NamedIndicatorComponent(pub ComponentName); impl NamedIndicatorComponent { #[inline] pub fn as_batch(&self) -> MaybeOwnedComponentBatch<'_> { - MaybeOwnedComponentBatch::Ref(self) + MaybeOwnedComponentBatch::new(self as &dyn crate::ComponentBatch) } #[inline] pub fn to_batch(self) -> MaybeOwnedComponentBatch<'static> { - MaybeOwnedComponentBatch::Owned(Box::new(self)) + MaybeOwnedComponentBatch::new(Box::new(self) as Box) } } @@ -290,7 +315,7 @@ impl crate::LoggableBatch for NamedIndicatorComponent { impl crate::ComponentBatch for NamedIndicatorComponent { #[inline] - fn name(&self) -> ComponentName { - self.0 + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + ComponentDescriptor::new(self.0).into() } } diff --git a/crates/store/re_types_core/src/archetypes/clear.rs b/crates/store/re_types_core/src/archetypes/clear.rs index 0fcbbb03603c3..569db300dfb21 100644 --- a/crates/store/re_types_core/src/archetypes/clear.rs +++ b/crates/store/re_types_core/src/archetypes/clear.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Archetype**: Empties all the components of an entity. @@ -78,32 +78,40 @@ pub struct Clear { pub is_recursive: crate::components::ClearIsRecursive, } -impl crate::SizeBytes for Clear { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.is_recursive.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.ClearIsRecursive".into()]); +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Clear".into()), + component_name: "rerun.components.ClearIsRecursive".into(), + archetype_field_name: Some("is_recursive".into()), + }] + }); -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.ClearIndicator".into()]); +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Clear".into()), + component_name: "ClearIndicator".into(), + archetype_field_name: None, + }] + }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.ClearIsRecursive".into(), - "rerun.components.ClearIndicator".into(), + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Clear".into()), + component_name: "rerun.components.ClearIsRecursive".into(), + archetype_field_name: Some("is_recursive".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Clear".into()), + component_name: "ClearIndicator".into(), + archetype_field_name: None, + }, ] }); @@ -131,26 +139,26 @@ impl crate::Archetype for Clear { #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { static INDICATOR: ClearIndicator = ClearIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) + MaybeOwnedComponentBatch::new(&INDICATOR as &dyn crate::ComponentBatch) } #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { REQUIRED_COMPONENTS.as_slice().into() } #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { RECOMMENDED_COMPONENTS.as_slice().into() } #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { OPTIONAL_COMPONENTS.as_slice().into() } #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { ALL_COMPONENTS.as_slice().into() } @@ -187,7 +195,16 @@ impl crate::AsComponents for Clear { use crate::Archetype as _; [ Some(Self::indicator()), - Some((&self.is_recursive as &dyn ComponentBatch).into()), + (Some(&self.is_recursive as &dyn ComponentBatch)).map(|batch| { + crate::MaybeOwnedComponentBatch { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Clear".into()), + archetype_field_name: Some(("is_recursive").into()), + component_name: ("rerun.components.ClearIsRecursive").into(), + }), + } + }), ] .into_iter() .flatten() @@ -206,3 +223,15 @@ impl Clear { } } } + +impl crate::SizeBytes for Clear { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.is_recursive.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/component_descriptor.rs b/crates/store/re_types_core/src/component_descriptor.rs new file mode 100644 index 0000000000000..0a39d06d09428 --- /dev/null +++ b/crates/store/re_types_core/src/component_descriptor.rs @@ -0,0 +1,177 @@ +use std::borrow::Cow; + +use crate::{ArchetypeFieldName, ArchetypeName, ComponentName, SizeBytes}; + +/// A [`ComponentDescriptor`] fully describes the semantics of a column of data. +/// +/// Every component is uniquely identified by its [`ComponentDescriptor`]. +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub struct ComponentDescriptor { + /// Optional name of the `Archetype` associated with this data. + /// + /// `None` if the data wasn't logged through an archetype. + /// + /// Example: `rerun.archetypes.Points3D`. + pub archetype_name: Option, + + /// Optional name of the field within `Archetype` associated with this data. + /// + /// `None` if the data wasn't logged through an archetype. + /// + /// Example: `positions`. + pub archetype_field_name: Option, + + /// Semantic name associated with this data. + /// + /// This is fully implied by `archetype_name` and `archetype_field`, but + /// included for semantic convenience. + /// + /// Example: `rerun.components.Position3D`. + pub component_name: ComponentName, +} + +impl std::hash::Hash for ComponentDescriptor { + #[inline] + fn hash(&self, state: &mut H) { + let Self { + archetype_name, + archetype_field_name, + component_name, + } = self; + + let archetype_name = archetype_name.map_or(0, |v| v.hash()); + let archetype_field_name = archetype_field_name.map_or(0, |v| v.hash()); + let component_name = component_name.hash(); + + state.write_u64(archetype_name ^ archetype_field_name ^ component_name); + } +} + +impl nohash_hasher::IsEnabled for ComponentDescriptor {} + +impl std::fmt::Display for ComponentDescriptor { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(&self.to_any_string(false)) + } +} + +impl From for Cow<'static, ComponentDescriptor> { + #[inline] + fn from(descr: ComponentDescriptor) -> Self { + Cow::Owned(descr) + } +} + +impl<'d> From<&'d ComponentDescriptor> for Cow<'d, ComponentDescriptor> { + #[inline] + fn from(descr: &'d ComponentDescriptor) -> Self { + Cow::Borrowed(descr) + } +} + +impl ComponentDescriptor { + fn to_any_string(&self, use_short_names: bool) -> String { + let Self { + archetype_name, + archetype_field_name, + component_name, + } = self; + + let (archetype_name, component_name) = if use_short_names { + ( + archetype_name.map(|s| s.short_name()), + component_name.short_name(), + ) + } else { + (archetype_name.map(|s| s.as_str()), component_name.as_str()) + }; + + match (archetype_name, component_name, archetype_field_name) { + (None, component_name, None) => component_name.to_owned(), + (Some(archetype_name), component_name, None) => { + format!("{archetype_name}:{component_name}") + } + (None, component_name, Some(archetype_field_name)) => { + format!("{component_name}#{archetype_field_name}") + } + (Some(archetype_name), component_name, Some(archetype_field_name)) => { + format!("{archetype_name}:{component_name}#{archetype_field_name}") + } + } + } + + /// Returns the fully-qualified name, e.g. `rerun.archetypes.Points3D:rerun.components.Position3D#positions`. + /// + /// This is the default `Display` implementation for [`ComponentDescriptor`]. + #[inline] + pub fn full_name(&self) -> String { + self.to_string() + } + + /// Returns the unqualified name, e.g. `Points3D:Position3D#positions`. + #[inline] + pub fn short_name(&self) -> String { + self.to_any_string(true) + } +} + +impl SizeBytes for ComponentDescriptor { + #[inline] + fn heap_size_bytes(&self) -> u64 { + let Self { + archetype_name, + archetype_field_name, + component_name, + } = self; + archetype_name.heap_size_bytes() + + component_name.heap_size_bytes() + + archetype_field_name.heap_size_bytes() + } +} + +impl ComponentDescriptor { + #[inline] + pub fn new(component_name: impl Into) -> Self { + let component_name = component_name.into(); + Self { + archetype_name: None, + archetype_field_name: None, + component_name, + } + } + + /// Unconditionally sets [`Self::archetype_name`] to the given one. + #[inline] + pub fn with_archetype_name(mut self, archetype_name: ArchetypeName) -> Self { + self.archetype_name = Some(archetype_name); + self + } + + /// Unconditionally sets [`Self::archetype_field_name`] to the given one. + #[inline] + pub fn with_archetype_field_name(mut self, archetype_field_name: ArchetypeFieldName) -> Self { + self.archetype_field_name = Some(archetype_field_name); + self + } + + /// Sets [`Self::archetype_name`] to the given one iff it's not already set. + #[inline] + pub fn or_with_archetype_name(mut self, archetype_name: impl Fn() -> ArchetypeName) -> Self { + if self.archetype_name.is_none() { + self.archetype_name = Some(archetype_name()); + } + self + } + + /// Sets [`Self::archetype_field_name`] to the given one iff it's not already set. + #[inline] + pub fn or_with_archetype_field_name( + mut self, + archetype_field_name: impl FnOnce() -> ArchetypeFieldName, + ) -> Self { + if self.archetype_field_name.is_none() { + self.archetype_field_name = Some(archetype_field_name()); + } + self + } +} diff --git a/crates/store/re_types_core/src/components/clear_is_recursive.rs b/crates/store/re_types_core/src/components/clear_is_recursive.rs index 04d68f0ab05ca..a70cd88f0f6f6 100644 --- a/crates/store/re_types_core/src/components/clear_is_recursive.rs +++ b/crates/store/re_types_core/src/components/clear_is_recursive.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Component**: Configures how a clear operation should behave - recursive or not. @@ -25,15 +25,43 @@ pub struct ClearIsRecursive( pub crate::datatypes::Bool, ); -impl crate::SizeBytes for ClearIsRecursive { +impl crate::Component for ClearIsRecursive { #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.ClearIsRecursive") } +} +crate::macros::impl_into_cow!(ClearIsRecursive); + +impl crate::Loggable for ClearIsRecursive { #[inline] - fn is_pod() -> bool { - ::is_pod() + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } } @@ -66,42 +94,14 @@ impl std::ops::DerefMut for ClearIsRecursive { } } -crate::macros::impl_into_cow!(ClearIsRecursive); - -impl crate::Loggable for ClearIsRecursive { +impl crate::SizeBytes for ClearIsRecursive { #[inline] - fn arrow_datatype() -> arrow::datatypes::DataType { - crate::datatypes::Bool::arrow_datatype() - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult - where - Self: Clone + 'a, - { - crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { - datum.map(|datum| match datum.into() { - ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), - ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), - }) - })) - } - - fn from_arrow2_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - crate::datatypes::Bool::from_arrow2_opt(arrow_data) - .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() } -} -impl crate::Component for ClearIsRecursive { #[inline] - fn name() -> ComponentName { - "rerun.components.ClearIsRecursive".into() + fn is_pod() -> bool { + ::is_pod() } } diff --git a/crates/store/re_types_core/src/datatypes/bool.rs b/crates/store/re_types_core/src/datatypes/bool.rs index 4ff9c81191f2d..6e26e5ec3a24f 100644 --- a/crates/store/re_types_core/src/datatypes/bool.rs +++ b/crates/store/re_types_core/src/datatypes/bool.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A single boolean. @@ -23,32 +23,6 @@ use crate::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Bool(pub bool); -impl crate::SizeBytes for Bool { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for Bool { - #[inline] - fn from(value: bool) -> Self { - Self(value) - } -} - -impl From for bool { - #[inline] - fn from(value: Bool) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(Bool); impl crate::Loggable for Bool { @@ -126,3 +100,29 @@ impl crate::Loggable for Bool { .with_context("rerun.datatypes.Bool")?) } } + +impl From for Bool { + #[inline] + fn from(value: bool) -> Self { + Self(value) + } +} + +impl From for bool { + #[inline] + fn from(value: Bool) -> Self { + value.0 + } +} + +impl crate::SizeBytes for Bool { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/entity_path.rs b/crates/store/re_types_core/src/datatypes/entity_path.rs index 6c276a78e8113..4adc411789e7a 100644 --- a/crates/store/re_types_core/src/datatypes/entity_path.rs +++ b/crates/store/re_types_core/src/datatypes/entity_path.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A path to an entity in the `ChunkStore`. @@ -23,32 +23,6 @@ use crate::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct EntityPath(pub crate::ArrowString); -impl crate::SizeBytes for EntityPath { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for EntityPath { - #[inline] - fn from(path: crate::ArrowString) -> Self { - Self(path) - } -} - -impl From for crate::ArrowString { - #[inline] - fn from(value: EntityPath) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(EntityPath); impl crate::Loggable for EntityPath { @@ -161,3 +135,29 @@ impl crate::Loggable for EntityPath { .with_context("rerun.datatypes.EntityPath")?) } } + +impl From for EntityPath { + #[inline] + fn from(path: crate::ArrowString) -> Self { + Self(path) + } +} + +impl From for crate::ArrowString { + #[inline] + fn from(value: EntityPath) -> Self { + value.0 + } +} + +impl crate::SizeBytes for EntityPath { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/float32.rs b/crates/store/re_types_core/src/datatypes/float32.rs index cde48a656d398..2148adcf77dc0 100644 --- a/crates/store/re_types_core/src/datatypes/float32.rs +++ b/crates/store/re_types_core/src/datatypes/float32.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A single-precision 32-bit IEEE 754 floating point number. @@ -23,32 +23,6 @@ use crate::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Float32(pub f32); -impl crate::SizeBytes for Float32 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for Float32 { - #[inline] - fn from(value: f32) -> Self { - Self(value) - } -} - -impl From for f32 { - #[inline] - fn from(value: Float32) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(Float32); impl crate::Loggable for Float32 { @@ -159,3 +133,29 @@ impl crate::Loggable for Float32 { }) } } + +impl From for Float32 { + #[inline] + fn from(value: f32) -> Self { + Self(value) + } +} + +impl From for f32 { + #[inline] + fn from(value: Float32) -> Self { + value.0 + } +} + +impl crate::SizeBytes for Float32 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/float64.rs b/crates/store/re_types_core/src/datatypes/float64.rs index d89edcdd06035..0bac3541168a0 100644 --- a/crates/store/re_types_core/src/datatypes/float64.rs +++ b/crates/store/re_types_core/src/datatypes/float64.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A double-precision 64-bit IEEE 754 floating point number. @@ -23,32 +23,6 @@ use crate::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Float64(pub f64); -impl crate::SizeBytes for Float64 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for Float64 { - #[inline] - fn from(value: f64) -> Self { - Self(value) - } -} - -impl From for f64 { - #[inline] - fn from(value: Float64) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(Float64); impl crate::Loggable for Float64 { @@ -159,3 +133,29 @@ impl crate::Loggable for Float64 { }) } } + +impl From for Float64 { + #[inline] + fn from(value: f64) -> Self { + Self(value) + } +} + +impl From for f64 { + #[inline] + fn from(value: Float64) -> Self { + value.0 + } +} + +impl crate::SizeBytes for Float64 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/time_int.rs b/crates/store/re_types_core/src/datatypes/time_int.rs index d40d1b3be4f8b..62dae7448c07d 100644 --- a/crates/store/re_types_core/src/datatypes/time_int.rs +++ b/crates/store/re_types_core/src/datatypes/time_int.rs @@ -13,41 +13,15 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A 64-bit number describing either nanoseconds OR sequence numbers. #[derive(Clone, Debug, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct TimeInt(pub i64); -impl crate::SizeBytes for TimeInt { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for TimeInt { - #[inline] - fn from(value: i64) -> Self { - Self(value) - } -} - -impl From for i64 { - #[inline] - fn from(value: TimeInt) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(TimeInt); impl crate::Loggable for TimeInt { @@ -158,3 +132,29 @@ impl crate::Loggable for TimeInt { }) } } + +impl From for TimeInt { + #[inline] + fn from(value: i64) -> Self { + Self(value) + } +} + +impl From for i64 { + #[inline] + fn from(value: TimeInt) -> Self { + value.0 + } +} + +impl crate::SizeBytes for TimeInt { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/time_range.rs b/crates/store/re_types_core/src/datatypes/time_range.rs index 79fe0c255b9cb..aadef83d26024 100644 --- a/crates/store/re_types_core/src/datatypes/time_range.rs +++ b/crates/store/re_types_core/src/datatypes/time_range.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: Visible time range bounds for a specific timeline. @@ -28,19 +28,6 @@ pub struct TimeRange { pub end: crate::datatypes::TimeRangeBoundary, } -impl crate::SizeBytes for TimeRange { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.start.heap_size_bytes() + self.end.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - } -} - crate::macros::impl_into_cow!(TimeRange); impl crate::Loggable for TimeRange { @@ -223,3 +210,16 @@ impl crate::Loggable for TimeRange { }) } } + +impl crate::SizeBytes for TimeRange { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.start.heap_size_bytes() + self.end.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + && ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/time_range_boundary.rs b/crates/store/re_types_core/src/datatypes/time_range_boundary.rs index c4f589b3dc006..943b907bc63f4 100644 --- a/crates/store/re_types_core/src/datatypes/time_range_boundary.rs +++ b/crates/store/re_types_core/src/datatypes/time_range_boundary.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: Left or right boundary of a time range. @@ -31,23 +31,6 @@ pub enum TimeRangeBoundary { Infinite, } -impl crate::SizeBytes for TimeRangeBoundary { - #[inline] - fn heap_size_bytes(&self) -> u64 { - #![allow(clippy::match_same_arms)] - match self { - Self::CursorRelative(v) => v.heap_size_bytes(), - Self::Absolute(v) => v.heap_size_bytes(), - Self::Infinite => 0, - } - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - crate::macros::impl_into_cow!(TimeRangeBoundary); impl crate::Loggable for TimeRangeBoundary { @@ -354,3 +337,20 @@ impl crate::Loggable for TimeRangeBoundary { }) } } + +impl crate::SizeBytes for TimeRangeBoundary { + #[inline] + fn heap_size_bytes(&self) -> u64 { + #![allow(clippy::match_same_arms)] + match self { + Self::CursorRelative(v) => v.heap_size_bytes(), + Self::Absolute(v) => v.heap_size_bytes(), + Self::Infinite => 0, + } + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/uint16.rs b/crates/store/re_types_core/src/datatypes/uint16.rs index 2f2a07f52df4e..454a08f638bfa 100644 --- a/crates/store/re_types_core/src/datatypes/uint16.rs +++ b/crates/store/re_types_core/src/datatypes/uint16.rs @@ -13,41 +13,15 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A 16bit unsigned integer. #[derive(Clone, Debug, Default, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct UInt16(pub u16); -impl crate::SizeBytes for UInt16 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for UInt16 { - #[inline] - fn from(value: u16) -> Self { - Self(value) - } -} - -impl From for u16 { - #[inline] - fn from(value: UInt16) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(UInt16); impl crate::Loggable for UInt16 { @@ -158,3 +132,29 @@ impl crate::Loggable for UInt16 { }) } } + +impl From for UInt16 { + #[inline] + fn from(value: u16) -> Self { + Self(value) + } +} + +impl From for u16 { + #[inline] + fn from(value: UInt16) -> Self { + value.0 + } +} + +impl crate::SizeBytes for UInt16 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/uint32.rs b/crates/store/re_types_core/src/datatypes/uint32.rs index 81d81d27c9fdb..66e736f6bc662 100644 --- a/crates/store/re_types_core/src/datatypes/uint32.rs +++ b/crates/store/re_types_core/src/datatypes/uint32.rs @@ -13,41 +13,15 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A 32bit unsigned integer. #[derive(Clone, Debug, Default, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct UInt32(pub u32); -impl crate::SizeBytes for UInt32 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for UInt32 { - #[inline] - fn from(value: u32) -> Self { - Self(value) - } -} - -impl From for u32 { - #[inline] - fn from(value: UInt32) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(UInt32); impl crate::Loggable for UInt32 { @@ -158,3 +132,29 @@ impl crate::Loggable for UInt32 { }) } } + +impl From for UInt32 { + #[inline] + fn from(value: u32) -> Self { + Self(value) + } +} + +impl From for u32 { + #[inline] + fn from(value: UInt32) -> Self { + value.0 + } +} + +impl crate::SizeBytes for UInt32 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/uint64.rs b/crates/store/re_types_core/src/datatypes/uint64.rs index bbde9100ee3bd..cbca12b268d09 100644 --- a/crates/store/re_types_core/src/datatypes/uint64.rs +++ b/crates/store/re_types_core/src/datatypes/uint64.rs @@ -13,41 +13,15 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A 64bit unsigned integer. #[derive(Clone, Debug, Default, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct UInt64(pub u64); -impl crate::SizeBytes for UInt64 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for UInt64 { - #[inline] - fn from(value: u64) -> Self { - Self(value) - } -} - -impl From for u64 { - #[inline] - fn from(value: UInt64) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(UInt64); impl crate::Loggable for UInt64 { @@ -158,3 +132,29 @@ impl crate::Loggable for UInt64 { }) } } + +impl From for UInt64 { + #[inline] + fn from(value: u64) -> Self { + Self(value) + } +} + +impl From for u64 { + #[inline] + fn from(value: UInt64) -> Self { + value.0 + } +} + +impl crate::SizeBytes for UInt64 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/utf8.rs b/crates/store/re_types_core/src/datatypes/utf8.rs index 1cf49c0065d09..2f9568776c10d 100644 --- a/crates/store/re_types_core/src/datatypes/utf8.rs +++ b/crates/store/re_types_core/src/datatypes/utf8.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: A string of text, encoded as UTF-8. @@ -23,32 +23,6 @@ use crate::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct Utf8(pub crate::ArrowString); -impl crate::SizeBytes for Utf8 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - } -} - -impl From for Utf8 { - #[inline] - fn from(value: crate::ArrowString) -> Self { - Self(value) - } -} - -impl From for crate::ArrowString { - #[inline] - fn from(value: Utf8) -> Self { - value.0 - } -} - crate::macros::impl_into_cow!(Utf8); impl crate::Loggable for Utf8 { @@ -161,3 +135,29 @@ impl crate::Loggable for Utf8 { .with_context("rerun.datatypes.Utf8")?) } } + +impl From for Utf8 { + #[inline] + fn from(value: crate::ArrowString) -> Self { + Self(value) + } +} + +impl From for crate::ArrowString { + #[inline] + fn from(value: Utf8) -> Self { + value.0 + } +} + +impl crate::SizeBytes for Utf8 { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/datatypes/visible_time_range.rs b/crates/store/re_types_core/src/datatypes/visible_time_range.rs index b2a741147f56e..1e2aade73bec0 100644 --- a/crates/store/re_types_core/src/datatypes/visible_time_range.rs +++ b/crates/store/re_types_core/src/datatypes/visible_time_range.rs @@ -13,9 +13,9 @@ #![allow(clippy::too_many_lines)] use crate::external::arrow2; -use crate::ComponentName; use crate::SerializationResult; use crate::{ComponentBatch, MaybeOwnedComponentBatch}; +use crate::{ComponentDescriptor, ComponentName}; use crate::{DeserializationError, DeserializationResult}; /// **Datatype**: Visible time range bounds for a specific timeline. @@ -28,18 +28,6 @@ pub struct VisibleTimeRange { pub range: crate::datatypes::TimeRange, } -impl crate::SizeBytes for VisibleTimeRange { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.timeline.heap_size_bytes() + self.range.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - crate::macros::impl_into_cow!(VisibleTimeRange); impl crate::Loggable for VisibleTimeRange { @@ -274,3 +262,15 @@ impl crate::Loggable for VisibleTimeRange { }) } } + +impl crate::SizeBytes for VisibleTimeRange { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.timeline.heap_size_bytes() + self.range.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() && ::is_pod() + } +} diff --git a/crates/store/re_types_core/src/lib.rs b/crates/store/re_types_core/src/lib.rs index 269dd4ab46782..9f276d9023d97 100644 --- a/crates/store/re_types_core/src/lib.rs +++ b/crates/store/re_types_core/src/lib.rs @@ -45,6 +45,9 @@ pub trait AsComponents { /// fully custom ones. /// Have a look at our [Custom Data Loader] example to learn more about extending archetypes. /// + /// Implementers of [`AsComponents`] get one last chance to override the tags in the + /// [`ComponentDescriptor`], see [`MaybeOwnedComponentBatch::descriptor_override`]. + /// /// [Custom Data Loader]: https://github.com/rerun-io/rerun/tree/latest/examples/rust/custom_data_loader // // NOTE: Don't bother returning a CoW here: we need to dynamically discard optional components @@ -66,7 +69,6 @@ pub trait AsComponents { .into_iter() .map(|comp_batch| { comp_batch - .as_ref() .to_arrow2() .map(|array| { let field = arrow2::datatypes::Field::new( @@ -76,7 +78,7 @@ pub trait AsComponents { ); (field, array) }) - .with_context(comp_batch.as_ref().name()) + .with_context(comp_batch.name()) }) .collect() } @@ -85,14 +87,14 @@ pub trait AsComponents { impl AsComponents for C { #[inline] fn as_component_batches(&self) -> Vec> { - vec![(self as &dyn ComponentBatch).into()] + vec![MaybeOwnedComponentBatch::new(self as &dyn ComponentBatch)] } } impl AsComponents for dyn ComponentBatch { #[inline] fn as_component_batches(&self) -> Vec> { - vec![MaybeOwnedComponentBatch::Ref(self)] + vec![MaybeOwnedComponentBatch::new(self)] } } @@ -100,7 +102,7 @@ impl AsComponents for [&dyn ComponentBatch; N] { #[inline] fn as_component_batches(&self) -> Vec> { self.iter() - .map(|batch| MaybeOwnedComponentBatch::Ref(*batch)) + .map(|batch| MaybeOwnedComponentBatch::new(*batch)) .collect() } } @@ -109,7 +111,7 @@ impl AsComponents for &[&dyn ComponentBatch] { #[inline] fn as_component_batches(&self) -> Vec> { self.iter() - .map(|batch| MaybeOwnedComponentBatch::Ref(*batch)) + .map(|batch| MaybeOwnedComponentBatch::new(*batch)) .collect() } } @@ -118,7 +120,7 @@ impl AsComponents for Vec<&dyn ComponentBatch> { #[inline] fn as_component_batches(&self) -> Vec> { self.iter() - .map(|batch| MaybeOwnedComponentBatch::Ref(*batch)) + .map(|batch| MaybeOwnedComponentBatch::new(*batch)) .collect() } } @@ -128,6 +130,7 @@ impl AsComponents for Vec<&dyn ComponentBatch> { mod archetype; mod arrow_buffer; mod arrow_string; +mod component_descriptor; mod loggable; mod loggable_batch; pub mod reflection; @@ -138,16 +141,17 @@ mod view; pub use self::{ archetype::{ - Archetype, ArchetypeName, ArchetypeReflectionMarker, GenericIndicatorComponent, - NamedIndicatorComponent, + Archetype, ArchetypeFieldName, ArchetypeName, ArchetypeReflectionMarker, + GenericIndicatorComponent, NamedIndicatorComponent, }, arrow_buffer::ArrowBuffer, arrow_string::ArrowString, + component_descriptor::ComponentDescriptor, loggable::{ Component, ComponentName, ComponentNameSet, DatatypeName, Loggable, UnorderedComponentNameSet, }, - loggable_batch::{ComponentBatch, LoggableBatch, MaybeOwnedComponentBatch}, + loggable_batch::{ComponentBatch, ComponentBatchCow, LoggableBatch, MaybeOwnedComponentBatch}, result::{ DeserializationError, DeserializationResult, ResultExt, SerializationError, SerializationResult, _Backtrace, @@ -189,7 +193,7 @@ pub mod external { pub use re_tuid; } -/// Useful macro for staticlly asserting that a `struct` contains some specific fields. +/// Useful macro for statically asserting that a `struct` contains some specific fields. /// /// In particular, this is useful to statcially check that an archetype /// has a specific component. diff --git a/crates/store/re_types_core/src/loggable.rs b/crates/store/re_types_core/src/loggable.rs index 9912a521ae589..6d4a305209b2c 100644 --- a/crates/store/re_types_core/src/loggable.rs +++ b/crates/store/re_types_core/src/loggable.rs @@ -1,6 +1,10 @@ +use std::borrow::Cow; + use nohash_hasher::IntSet; -use crate::{result::_Backtrace, DeserializationResult, SerializationResult, SizeBytes}; +use crate::{ + result::_Backtrace, ComponentDescriptor, DeserializationResult, SerializationResult, SizeBytes, +}; #[allow(unused_imports)] // used in docstrings use crate::{Archetype, ComponentBatch, LoggableBatch}; @@ -147,8 +151,35 @@ pub trait Loggable: 'static + Send + Sync + Clone + Sized + SizeBytes { /// Implementing the [`Component`] trait automatically derives the [`ComponentBatch`] implementation, /// which makes it possible to work with lists' worth of data in a generic fashion. pub trait Component: Loggable { + /// Returns the complete [`ComponentDescriptor`] for this [`Component`]. + /// + /// Every component is uniquely identified by its [`ComponentDescriptor`]. + // + // NOTE: Builtin Rerun components don't (yet) have anything but a `ComponentName` attached to + // them (other tags are injected at the Archetype level), therefore having a full + // `ComponentDescriptor` might seem overkill. + // It's not: + // * Users might still want to register Components with specific tags. + // * In the future, `ComponentDescriptor`s will very likely cover than Archetype-related tags + // (e.g. generics, metric units, etc). + fn descriptor() -> ComponentDescriptor; + /// The fully-qualified name of this component, e.g. `rerun.components.Position2D`. - fn name() -> ComponentName; + /// + /// This is a trivial but useful helper for `Self::descriptor().component_name`. + /// + /// The default implementation already does the right thing: do not override unless you know + /// what you're doing. + /// `Self::name()` must exactly match the value returned by `Self::descriptor().component_name`, + /// or undefined behavior ensues. + // + // TODO(cmc): The only reason we keep this around is for convenience, and the only reason we need this + // convenience is because we're still in this weird half-way in-between state where some things + // are still indexed by name. Remove this entirely once we've ported everything to descriptors. + #[inline] + fn name() -> ComponentName { + Self::descriptor().component_name + } } // --- @@ -162,6 +193,26 @@ re_string_interner::declare_new_type!( pub struct ComponentName; ); +// TODO(cmc): The only reason this exists is for convenience, and the only reason we need this +// convenience is because we're still in this weird half-way in-between state where some things +// are still indexed by name. Remove this entirely once we've ported everything to descriptors. +impl From for Cow<'static, ComponentDescriptor> { + #[inline] + fn from(name: ComponentName) -> Self { + Cow::Owned(ComponentDescriptor::new(name)) + } +} + +// TODO(cmc): The only reason this exists is for convenience, and the only reason we need this +// convenience is because we're still in this weird half-way in-between state where some things +// are still indexed by name. Remove this entirely once we've ported everything to descriptors. +impl From<&ComponentName> for Cow<'static, ComponentDescriptor> { + #[inline] + fn from(name: &ComponentName) -> Self { + Cow::Owned(ComponentDescriptor::new(*name)) + } +} + impl ComponentName { /// Returns the fully-qualified name, e.g. `rerun.components.Position2D`. /// diff --git a/crates/store/re_types_core/src/loggable_batch.rs b/crates/store/re_types_core/src/loggable_batch.rs index 25c1d7a50d4be..208890f8e2ad8 100644 --- a/crates/store/re_types_core/src/loggable_batch.rs +++ b/crates/store/re_types_core/src/loggable_batch.rs @@ -1,4 +1,6 @@ -use crate::{Component, ComponentName, Loggable, SerializationResult}; +use std::borrow::Cow; + +use crate::{Component, ComponentDescriptor, ComponentName, Loggable, SerializationResult}; use arrow2::array::ListArray as Arrow2ListArray; @@ -27,9 +29,6 @@ pub trait LoggableBatch { /// A [`ComponentBatch`] represents an array's worth of [`Component`] instances. pub trait ComponentBatch: LoggableBatch { - /// The fully-qualified name of this component batch, e.g. `rerun.components.Position2D`. - fn name(&self) -> ComponentName; - /// Serializes the batch into an Arrow list array with a single component per list. fn to_arrow_list_array(&self) -> SerializationResult> { let array = self.to_arrow2()?; @@ -39,64 +38,131 @@ pub trait ComponentBatch: LoggableBatch { Arrow2ListArray::::try_new(data_type, offsets.into(), array.to_boxed(), None) .map_err(|err| err.into()) } + + /// Returns the complete [`ComponentDescriptor`] for this [`ComponentBatch`]. + /// + /// Every component batch is uniquely identified by its [`ComponentDescriptor`]. + fn descriptor(&self) -> Cow<'_, ComponentDescriptor>; + + /// The fully-qualified name of this component batch, e.g. `rerun.components.Position2D`. + /// + /// This is a trivial but useful helper for `self.descriptor().component_name`. + /// + /// The default implementation already does the right thing. Do not override unless you know + /// what you're doing. + /// `Self::name()` must exactly match the value returned by `self.descriptor().component_name`, + /// or undefined behavior ensues. + #[inline] + fn name(&self) -> ComponentName { + self.descriptor().component_name + } +} + +/// Some [`ComponentBatch`], optionally with an overridden [`ComponentDescriptor`]. +/// +/// Used by implementers of [`crate::AsComponents`] to both efficiently expose their component data +/// and assign the right tags given the surrounding context. +pub struct MaybeOwnedComponentBatch<'a> { + /// The component data. + pub batch: ComponentBatchCow<'a>, + + /// If set, will override the [`ComponentBatch`]'s [`ComponentDescriptor`]. + pub descriptor_override: Option, +} + +impl<'a> From> for MaybeOwnedComponentBatch<'a> { + #[inline] + fn from(batch: ComponentBatchCow<'a>) -> Self { + Self::new(batch) + } +} + +impl<'a> MaybeOwnedComponentBatch<'a> { + #[inline] + pub fn new(batch: impl Into>) -> Self { + Self { + batch: batch.into(), + descriptor_override: None, + } + } + + #[inline] + pub fn with_descriptor_override(self, descriptor: ComponentDescriptor) -> Self { + Self { + descriptor_override: Some(descriptor), + ..self + } + } +} + +impl LoggableBatch for MaybeOwnedComponentBatch<'_> { + #[inline] + fn to_arrow2(&self) -> SerializationResult> { + self.batch.to_arrow2() + } +} + +impl<'a> ComponentBatch for MaybeOwnedComponentBatch<'a> { + #[inline] + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + self.descriptor_override + .as_ref() + .map(Into::into) + .unwrap_or_else(|| self.batch.descriptor()) + } + + #[inline] + fn name(&self) -> ComponentName { + self.batch.name() + } } /// Holds either an owned [`ComponentBatch`] that lives on heap, or a reference to one. /// /// This doesn't use [`std::borrow::Cow`] on purpose: `Cow` requires `Clone`, which would break /// object-safety, which would prevent us from erasing [`ComponentBatch`]s in the first place. -pub enum MaybeOwnedComponentBatch<'a> { +pub enum ComponentBatchCow<'a> { Owned(Box), Ref(&'a dyn ComponentBatch), } -impl<'a> From<&'a dyn ComponentBatch> for MaybeOwnedComponentBatch<'a> { +impl<'a> From<&'a dyn ComponentBatch> for ComponentBatchCow<'a> { #[inline] fn from(comp_batch: &'a dyn ComponentBatch) -> Self { Self::Ref(comp_batch) } } -impl From> for MaybeOwnedComponentBatch<'_> { +impl From> for ComponentBatchCow<'_> { #[inline] fn from(comp_batch: Box) -> Self { Self::Owned(comp_batch) } } -impl<'a> AsRef for MaybeOwnedComponentBatch<'a> { - #[inline] - fn as_ref(&self) -> &(dyn ComponentBatch + 'a) { - match self { - MaybeOwnedComponentBatch::Owned(this) => &**this, - MaybeOwnedComponentBatch::Ref(this) => *this, - } - } -} - -impl<'a> std::ops::Deref for MaybeOwnedComponentBatch<'a> { +impl<'a> std::ops::Deref for ComponentBatchCow<'a> { type Target = dyn ComponentBatch + 'a; #[inline] fn deref(&self) -> &(dyn ComponentBatch + 'a) { match self { - MaybeOwnedComponentBatch::Owned(this) => &**this, - MaybeOwnedComponentBatch::Ref(this) => *this, + ComponentBatchCow::Owned(this) => &**this, + ComponentBatchCow::Ref(this) => *this, } } } -impl LoggableBatch for MaybeOwnedComponentBatch<'_> { +impl<'a> LoggableBatch for ComponentBatchCow<'a> { #[inline] fn to_arrow2(&self) -> SerializationResult> { - self.as_ref().to_arrow2() + (**self).to_arrow2() } } -impl ComponentBatch for MaybeOwnedComponentBatch<'_> { +impl<'a> ComponentBatch for ComponentBatchCow<'a> { #[inline] - fn name(&self) -> ComponentName { - self.as_ref().name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + (**self).descriptor() } } @@ -110,8 +176,9 @@ impl LoggableBatch for L { } impl ComponentBatch for C { - fn name(&self) -> ComponentName { - C::name() + #[inline] + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -126,8 +193,8 @@ impl LoggableBatch for Option { impl ComponentBatch for Option { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -142,8 +209,8 @@ impl LoggableBatch for Vec { impl ComponentBatch for Vec { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -161,8 +228,8 @@ impl LoggableBatch for Vec> { impl ComponentBatch for Vec> { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -177,8 +244,8 @@ impl LoggableBatch for [L; N] { impl ComponentBatch for [C; N] { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -196,8 +263,8 @@ impl LoggableBatch for [Option; N] { impl ComponentBatch for [Option; N] { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -212,8 +279,8 @@ impl LoggableBatch for &[L] { impl ComponentBatch for &[C] { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -231,8 +298,8 @@ impl LoggableBatch for &[Option] { impl ComponentBatch for &[Option] { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -247,8 +314,8 @@ impl LoggableBatch for &[L; N] { impl ComponentBatch for &[C; N] { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } @@ -266,7 +333,7 @@ impl LoggableBatch for &[Option; N] { impl ComponentBatch for &[Option; N] { #[inline] - fn name(&self) -> ComponentName { - C::name() + fn descriptor(&self) -> Cow<'_, ComponentDescriptor> { + C::descriptor().into() } } diff --git a/crates/store/re_types_core/src/tuid.rs b/crates/store/re_types_core/src/tuid.rs index 71e4e1d62bac2..92f017297e271 100644 --- a/crates/store/re_types_core/src/tuid.rs +++ b/crates/store/re_types_core/src/tuid.rs @@ -189,6 +189,11 @@ macro_rules! delegate_arrow_tuid { fn name() -> $crate::ComponentName { $fqname.into() } + + #[inline] + fn descriptor() -> $crate::ComponentDescriptor { + $crate::ComponentDescriptor::new($fqname) + } } }; } diff --git a/crates/top/re_sdk/src/lib.rs b/crates/top/re_sdk/src/lib.rs index 67ecfc4e2c214..32a2b5c505922 100644 --- a/crates/top/re_sdk/src/lib.rs +++ b/crates/top/re_sdk/src/lib.rs @@ -77,8 +77,9 @@ pub mod sink { /// Things directly related to logging. pub mod log { pub use re_chunk::{ - Chunk, ChunkBatcher, ChunkBatcherConfig, ChunkBatcherError, ChunkBatcherResult, ChunkError, - ChunkId, ChunkResult, PendingRow, RowId, TimeColumn, TransportChunk, + Chunk, ChunkBatcher, ChunkBatcherConfig, ChunkBatcherError, ChunkBatcherResult, + ChunkComponents, ChunkError, ChunkId, ChunkResult, PendingRow, RowId, TimeColumn, + TransportChunk, }; pub use re_log_types::LogMsg; } @@ -90,9 +91,10 @@ pub mod time { pub use time::{Time, TimePoint, Timeline}; pub use re_types_core::{ - Archetype, ArchetypeName, AsComponents, Component, ComponentBatch, ComponentName, DatatypeName, + Archetype, ArchetypeName, AsComponents, Component, ComponentBatch, ComponentDescriptor, + ComponentName, DatatypeName, DeserializationError, DeserializationResult, GenericIndicatorComponent, Loggable, LoggableBatch, MaybeOwnedComponentBatch, - NamedIndicatorComponent, SizeBytes, + NamedIndicatorComponent, SerializationError, SerializationResult, SizeBytes, }; #[cfg(feature = "data_loaders")] diff --git a/crates/top/re_sdk/src/recording_stream.rs b/crates/top/re_sdk/src/recording_stream.rs index c5b9abc6a1fb8..41d1e94381740 100644 --- a/crates/top/re_sdk/src/recording_stream.rs +++ b/crates/top/re_sdk/src/recording_stream.rs @@ -9,10 +9,12 @@ use itertools::Either; use nohash_hasher::IntMap; use parking_lot::Mutex; -use arrow2::array::{ListArray as ArrowListArray, PrimitiveArray as Arrow2PrimitiveArray}; -use re_chunk::{Chunk, ChunkBatcher, ChunkBatcherConfig, ChunkBatcherError, PendingRow, RowId}; +use arrow2::array::PrimitiveArray as Arrow2PrimitiveArray; +use re_chunk::{ + Chunk, ChunkBatcher, ChunkBatcherConfig, ChunkBatcherError, ChunkComponents, PendingRow, RowId, +}; -use re_chunk::{ChunkError, ChunkId, ComponentName, TimeColumn}; +use re_chunk::{ChunkError, ChunkId, TimeColumn}; use re_log_types::{ ApplicationId, ArrowChunkReleaseCallback, BlueprintActivationCommand, EntityPath, LogMsg, StoreId, StoreInfo, StoreKind, StoreSource, Time, TimeInt, TimePoint, TimeType, Timeline, @@ -1013,11 +1015,37 @@ impl RecordingStream { let components: Result, ChunkError> = components .into_iter() - .map(|batch| Ok((batch.name(), batch.to_arrow_list_array()?))) + .map(|batch| { + Ok(( + batch.descriptor().into_owned(), + batch.to_arrow_list_array()?, + )) + }) .collect(); - let components: IntMap> = - components?.into_iter().collect(); + let components: ChunkComponents = components?.into_iter().collect(); + + { + let mut all_lengths = + timelines + .values() + .map(|timeline| (timeline.name(), timeline.num_rows())) + .chain(components.iter_flattened().map(|(descr, list_array)| { + (descr.component_name.as_str(), list_array.len()) + })); + + if let Some((_, expected)) = all_lengths.next() { + for (name, len) in all_lengths { + if len != expected { + return Err(RecordingStreamError::Chunk(ChunkError::Malformed { + reason: format!( + "Mismatched lengths: '{name}' has length {len} but expected {expected}", + ), + })); + } + } + } + } let chunk = Chunk::from_auto_row_ids(id, ent_path.into(), timelines, components)?; @@ -1116,7 +1144,7 @@ impl RecordingStream { as_components .as_component_batches() .iter() - .map(|any_comp_batch| any_comp_batch.as_ref()), + .map(|any_comp_batch| any_comp_batch as &dyn re_types_core::ComponentBatch), ) } @@ -1171,7 +1199,7 @@ impl RecordingStream { .map(|comp_batch| { comp_batch .to_arrow2() - .map(|array| (comp_batch.name(), array)) + .map(|array| (comp_batch.descriptor().into_owned(), array)) }) .collect(); let components: IntMap<_, _> = comp_batches?.into_iter().collect(); @@ -2528,7 +2556,7 @@ mod tests { fn example_rows(timeless: bool) -> Vec { use re_log_types::example_components::{MyColor, MyLabel, MyPoint}; - use re_types_core::Component as _; + use re_types_core::{Component as _, Loggable}; let mut tick = 0i64; let mut timepoint = |frame_nr: i64| { @@ -2548,22 +2576,20 @@ mod tests { timepoint: timepoint(1), components: [ ( - MyPoint::name(), - ::to_arrow2([ + MyPoint::descriptor(), + ::to_arrow2([ MyPoint::new(10.0, 10.0), MyPoint::new(20.0, 20.0), ]) .unwrap(), ), // ( - MyColor::name(), - ::to_arrow2([MyColor(0x8080_80FF)]) - .unwrap(), + MyColor::descriptor(), + ::to_arrow2([MyColor(0x8080_80FF)]).unwrap(), ), // ( - MyLabel::name(), - ::to_arrow2([] as [MyLabel; 0]) - .unwrap(), + MyLabel::descriptor(), + ::to_arrow2([] as [MyLabel; 0]).unwrap(), ), // ] .into_iter() @@ -2577,19 +2603,16 @@ mod tests { timepoint: timepoint(1), components: [ ( - MyPoint::name(), - ::to_arrow2([] as [MyPoint; 0]) - .unwrap(), + MyPoint::descriptor(), + ::to_arrow2([] as [MyPoint; 0]).unwrap(), ), // ( - MyColor::name(), - ::to_arrow2([] as [MyColor; 0]) - .unwrap(), + MyColor::descriptor(), + ::to_arrow2([] as [MyColor; 0]).unwrap(), ), // ( - MyLabel::name(), - ::to_arrow2([] as [MyLabel; 0]) - .unwrap(), + MyLabel::descriptor(), + ::to_arrow2([] as [MyLabel; 0]).unwrap(), ), // ] .into_iter() @@ -2603,19 +2626,16 @@ mod tests { timepoint: timepoint(1), components: [ ( - MyPoint::name(), - ::to_arrow2([] as [MyPoint; 0]) - .unwrap(), + MyPoint::descriptor(), + ::to_arrow2([] as [MyPoint; 0]).unwrap(), ), // ( - MyColor::name(), - ::to_arrow2([MyColor(0xFFFF_FFFF)]) - .unwrap(), + MyColor::descriptor(), + ::to_arrow2([MyColor(0xFFFF_FFFF)]).unwrap(), ), // ( - MyLabel::name(), - ::to_arrow2([MyLabel("hey".into())]) - .unwrap(), + MyLabel::descriptor(), + ::to_arrow2([MyLabel("hey".into())]).unwrap(), ), // ] .into_iter() diff --git a/crates/top/rerun_c/src/lib.rs b/crates/top/rerun_c/src/lib.rs index 0482d3f0a9185..a6995a04f5d9c 100644 --- a/crates/top/rerun_c/src/lib.rs +++ b/crates/top/rerun_c/src/lib.rs @@ -20,10 +20,10 @@ use once_cell::sync::Lazy; use arrow_utils::arrow_array_from_c_ffi; use re_sdk::{ external::nohash_hasher::IntMap, - log::{Chunk, ChunkId, PendingRow, TimeColumn}, + log::{Chunk, ChunkComponents, ChunkId, PendingRow, TimeColumn}, time::TimeType, - ComponentName, EntityPath, RecordingStream, RecordingStreamBuilder, StoreKind, TimePoint, - Timeline, + ComponentDescriptor, ComponentName, EntityPath, RecordingStream, RecordingStreamBuilder, + StoreKind, TimePoint, Timeline, }; use recording_streams::{recording_stream, RECORDING_STREAMS}; @@ -790,7 +790,7 @@ fn rr_recording_stream_log_impl( let component_type = component_type_registry.get(*component_type)?; let datatype = component_type.datatype.clone(); let values = unsafe { arrow_array_from_c_ffi(array, datatype) }?; - components.insert(component_type.name, values); + components.insert(ComponentDescriptor::new(component_type.name), values); } } @@ -953,7 +953,7 @@ fn rr_recording_stream_send_columns_impl( }) .collect::>()?; - let components: IntMap> = { + let components: IntMap> = { let component_type_registry = COMPONENT_TYPES.read(); component_columns .iter() @@ -978,11 +978,13 @@ fn rr_recording_stream_send_columns_impl( ) })?; - Ok((component_type.name, component_values.clone())) + Ok((ComponentDescriptor::new(component_type.name), component_values.clone())) }) .collect::>()? }; + let components: ChunkComponents = components.into_iter().collect(); + let chunk = Chunk::from_auto_row_ids(id, entity_path.into(), time_columns, components) .map_err(|err| { CError::new( diff --git a/crates/viewer/re_chunk_store_ui/src/chunk_ui.rs b/crates/viewer/re_chunk_store_ui/src/chunk_ui.rs index f27784c4aa053..2007531b75124 100644 --- a/crates/viewer/re_chunk_store_ui/src/chunk_ui.rs +++ b/crates/viewer/re_chunk_store_ui/src/chunk_ui.rs @@ -76,9 +76,12 @@ impl ChunkUi { let components = chunk .components() - .iter() - .map(|(component_name, list_array)| { - (*component_name, format!("{:#?}", list_array.data_type())) + .iter_flattened() + .map(|(component_desc, list_array)| { + ( + component_desc.clone(), + format!("{:#?}", list_array.data_type()), + ) }) .collect::>(); @@ -93,13 +96,15 @@ impl ChunkUi { }); } - for (component_name, datatype) in &components { + for (component_desc, datatype) in &components { row.col(|ui| { ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); - let response = ui.button(component_name.short_name()).on_hover_ui(|ui| { - ui.label(format!("{datatype}\n\nClick header to copy")); - }); + let response = ui + .button(component_desc.component_name.short_name()) + .on_hover_ui(|ui| { + ui.label(format!("{datatype}\n\nClick header to copy")); + }); if response.clicked() { ui.output_mut(|o| o.copied_text = datatype.clone()); @@ -136,11 +141,12 @@ impl ChunkUi { }); } - for component_name in components.keys() { + for component_desc in components.keys() { row.col(|ui| { ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); - let component_data = chunk.component_batch_raw(component_name, row_index); + let component_data = + chunk.component_batch_raw(&component_desc.component_name, row_index); match component_data { Some(Ok(data)) => { crate::arrow_ui::arrow_ui(ui, &*data); diff --git a/crates/viewer/re_data_ui/src/instance_path.rs b/crates/viewer/re_data_ui/src/instance_path.rs index 7dd2d6b9026de..7d5c334d1887d 100644 --- a/crates/viewer/re_data_ui/src/instance_path.rs +++ b/crates/viewer/re_data_ui/src/instance_path.rs @@ -286,9 +286,14 @@ fn preview_if_image_ui( .component_mono::()? .ok()?; - let kind = if component_map.contains_key(&archetypes::DepthImage::indicator().name()) { + // TODO(#8129): it's ugly but indicators are going away next anyway. + let kind = if component_map.contains_key(&re_types_core::ComponentBatch::name( + &archetypes::DepthImage::indicator(), + )) { ImageKind::Depth - } else if component_map.contains_key(&archetypes::SegmentationImage::indicator().name()) { + } else if component_map.contains_key(&re_types_core::ComponentBatch::name( + &archetypes::SegmentationImage::indicator(), + )) { ImageKind::Segmentation } else { ImageKind::Color diff --git a/crates/viewer/re_selection_panel/src/defaults_ui.rs b/crates/viewer/re_selection_panel/src/defaults_ui.rs index 608a6541c2059..ff8daf3d2ba5d 100644 --- a/crates/viewer/re_selection_panel/src/defaults_ui.rs +++ b/crates/viewer/re_selection_panel/src/defaults_ui.rs @@ -6,7 +6,7 @@ use re_chunk::{Chunk, RowId}; use re_chunk_store::LatestAtQuery; use re_data_ui::{sorted_component_list_for_ui, DataUi as _}; use re_log_types::EntityPath; -use re_types_core::{ComponentName, ComponentNameSet}; +use re_types_core::{ComponentDescriptor, ComponentName, ComponentNameSet}; use re_ui::{list_item::LabelContent, UiExt as _}; use re_viewer_context::{ blueprint_timeline, ComponentUiTypes, QueryContext, SystemCommand, SystemCommandSender as _, @@ -304,7 +304,7 @@ fn add_popup_ui( .with_row( RowId::new(), ctx.blueprint_timepoint_for_writes(), - [(component_name, initial_data)], + [(ComponentDescriptor::new(component_name), initial_data)], ) .build() { diff --git a/crates/viewer/re_space_view/src/annotation_scene_context.rs b/crates/viewer/re_space_view/src/annotation_scene_context.rs index f5328cb69f1a8..0479821b2eadd 100644 --- a/crates/viewer/re_space_view/src/annotation_scene_context.rs +++ b/crates/viewer/re_space_view/src/annotation_scene_context.rs @@ -17,7 +17,7 @@ impl ViewContextSystem for AnnotationSceneContext { vec![ AnnotationContext::required_components() .iter() - .map(ToOwned::to_owned) + .map(|descr| descr.component_name) .collect(), // ] } diff --git a/crates/viewer/re_space_view/src/lib.rs b/crates/viewer/re_space_view/src/lib.rs index e6620167efc8b..2b9f4cb188859 100644 --- a/crates/viewer/re_space_view/src/lib.rs +++ b/crates/viewer/re_space_view/src/lib.rs @@ -49,7 +49,7 @@ pub fn diff_component_filter( .diff .chunk .components() - .get(&T::name()) + .get_descriptor(&T::descriptor()) .map_or(false, |list_array| { list_array .iter() diff --git a/crates/viewer/re_space_view/src/query.rs b/crates/viewer/re_space_view/src/query.rs index 4c41a2274d896..e554f4d07fefd 100644 --- a/crates/viewer/re_space_view/src/query.rs +++ b/crates/viewer/re_space_view/src/query.rs @@ -34,17 +34,17 @@ pub fn range_with_blueprint_resolved_data( ) -> HybridRangeResults { re_tracing::profile_function!(data_result.entity_path.to_string()); - let mut component_set = component_names.into_iter().collect::>(); + let mut component_name_set = component_names.into_iter().collect::>(); - let overrides = query_overrides(ctx.viewer_ctx, data_result, component_set.iter()); + let overrides = query_overrides(ctx.viewer_ctx, data_result, component_name_set.iter()); // No need to query for components that have overrides. - component_set.retain(|component| !overrides.components.contains_key(component)); + component_name_set.retain(|component| !overrides.components.contains_key(component)); let results = ctx.recording_engine().cache().range( range_query, &data_result.entity_path, - component_set.iter().copied(), + component_name_set.iter(), ); // TODO(jleibs): This doesn't work when the component set contains empty results. @@ -54,7 +54,7 @@ pub fn range_with_blueprint_resolved_data( let defaults = ctx.viewer_ctx.blueprint_engine().cache().latest_at( ctx.viewer_ctx.blueprint_query, ctx.defaults_path, - component_set.iter().copied(), + component_name_set.iter().copied(), ); HybridRangeResults { @@ -260,7 +260,7 @@ impl DataResultQuery for DataResult { None, latest_at_query, self, - A::all_components().iter().copied(), + A::all_components().iter().map(|descr| descr.component_name), query_shadowed_defaults, ) } @@ -275,7 +275,7 @@ impl DataResultQuery for DataResult { &view_query.timeline, view_query.latest_at, self.query_range(), - A::all_components().iter().copied(), + A::all_components().iter().map(|descr| descr.component_name), self, ) } diff --git a/crates/viewer/re_space_view_spatial/src/contexts/transform_context.rs b/crates/viewer/re_space_view_spatial/src/contexts/transform_context.rs index 87e41460f9214..3ad4225b0d7db 100644 --- a/crates/viewer/re_space_view_spatial/src/contexts/transform_context.rs +++ b/crates/viewer/re_space_view_spatial/src/contexts/transform_context.rs @@ -159,8 +159,14 @@ impl Default for TransformContext { impl ViewContextSystem for TransformContext { fn compatible_component_sets(&self) -> Vec { vec![ - Transform3D::all_components().iter().copied().collect(), - InstancePoses3D::all_components().iter().copied().collect(), + Transform3D::all_components() + .iter() + .map(|descr| descr.component_name) + .collect(), + InstancePoses3D::all_components() + .iter() + .map(|descr| descr.component_name) + .collect(), std::iter::once(PinholeProjection::name()).collect(), std::iter::once(DisconnectedSpace::name()).collect(), ] diff --git a/crates/viewer/re_space_view_spatial/src/max_image_dimension_subscriber.rs b/crates/viewer/re_space_view_spatial/src/max_image_dimension_subscriber.rs index 32bc0adc65a4f..26485456d7c53 100644 --- a/crates/viewer/re_space_view_spatial/src/max_image_dimension_subscriber.rs +++ b/crates/viewer/re_space_view_spatial/src/max_image_dimension_subscriber.rs @@ -78,7 +78,13 @@ impl ChunkStoreSubscriber for MaxImageDimensionSubscriber { } // Handle `Image`, `DepthImage`, `SegmentationImage`… - if let Some(all_dimensions) = event.diff.chunk.components().get(&ImageFormat::name()) { + if let Some(all_dimensions) = event + .diff + .chunk + .components() + .get(&ImageFormat::name()) + .and_then(|per_desc| per_desc.values().next()) + { for new_dim in all_dimensions.iter().filter_map(|array| { array.and_then(|array| { ImageFormat::from_arrow2(&*array).ok()?.into_iter().next() diff --git a/crates/viewer/re_space_view_spatial/src/transform_component_tracker.rs b/crates/viewer/re_space_view_spatial/src/transform_component_tracker.rs index 8016aad431188..316dd56db713c 100644 --- a/crates/viewer/re_space_view_spatial/src/transform_component_tracker.rs +++ b/crates/viewer/re_space_view_spatial/src/transform_component_tracker.rs @@ -77,11 +77,11 @@ impl Default for TransformComponentTrackerStoreSubscriber { Self { transform_components: re_types::archetypes::Transform3D::all_components() .iter() - .copied() + .map(|descr| descr.component_name) .collect(), pose_components: re_types::archetypes::InstancePoses3D::all_components() .iter() - .copied() + .map(|descr| descr.component_name) .collect(), per_store: Default::default(), } @@ -132,8 +132,10 @@ impl ChunkStoreSubscriber for TransformComponentTrackerStoreSubscriber { .chunk .components() .get(&component_name) - .map_or(false, |list_array| { - list_array.offsets().lengths().any(|len| len > 0) + .map_or(false, |per_desc| { + per_desc + .values() + .any(|list_array| list_array.offsets().lengths().any(|len| len > 0)) }) }; diff --git a/crates/viewer/re_space_view_spatial/src/view_2d.rs b/crates/viewer/re_space_view_spatial/src/view_2d.rs index 643bf5479caa8..00b77f578f747 100644 --- a/crates/viewer/re_space_view_spatial/src/view_2d.rs +++ b/crates/viewer/re_space_view_spatial/src/view_2d.rs @@ -369,6 +369,7 @@ fn recommended_space_views_with_image_splits( &mut found_image_dimensions, ); + use re_types::ComponentBatch as _; let image_count = count_non_nested_images_with_component( image_dimensions, entities, diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/transform3d_arrows.rs b/crates/viewer/re_space_view_spatial/src/visualizers/transform3d_arrows.rs index 712588b1ec68a..cd2f9b7b43433 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/transform3d_arrows.rs +++ b/crates/viewer/re_space_view_spatial/src/visualizers/transform3d_arrows.rs @@ -65,7 +65,7 @@ impl VisualizerSystem for Transform3DArrowsVisualizer { Some(Box::new(Transform3DApplicabilityFilter { applicability_trigger_components: Transform3D::all_components() .iter() - .copied() + .map(|descr| descr.component_name) .collect(), })) } diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/videos.rs b/crates/viewer/re_space_view_spatial/src/visualizers/videos.rs index 4bafb9ea30997..3347dd28eeb98 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/videos.rs +++ b/crates/viewer/re_space_view_spatial/src/visualizers/videos.rs @@ -409,7 +409,7 @@ fn latest_at_query_video_from_datastore( let results = ctx.recording_engine().cache().latest_at( &query, entity_path, - AssetVideo::all_components().iter().copied(), + AssetVideo::all_components().iter(), ); let blob_row_id = results.component_row_id(&Blob::name())?; diff --git a/crates/viewer/re_space_view_time_series/src/line_visualizer_system.rs b/crates/viewer/re_space_view_time_series/src/line_visualizer_system.rs index 47af47be660d6..212ef41733c2f 100644 --- a/crates/viewer/re_space_view_time_series/src/line_visualizer_system.rs +++ b/crates/viewer/re_space_view_time_series/src/line_visualizer_system.rs @@ -38,10 +38,15 @@ const DEFAULT_STROKE_WIDTH: f32 = 0.75; impl VisualizerSystem for SeriesLineSystem { fn visualizer_query_info(&self) -> VisualizerQueryInfo { let mut query_info = VisualizerQueryInfo::from_archetype::(); - query_info - .queried - .extend(SeriesLine::all_components().iter().map(ToOwned::to_owned)); + query_info.queried.extend( + SeriesLine::all_components() + .iter() + .map(|descr| descr.component_name), + ); + + use re_types::ComponentBatch as _; query_info.indicators = std::iter::once(SeriesLine::indicator().name()).collect(); + query_info } diff --git a/crates/viewer/re_space_view_time_series/src/point_visualizer_system.rs b/crates/viewer/re_space_view_time_series/src/point_visualizer_system.rs index c0a9f2aedf78c..dc232568df7c5 100644 --- a/crates/viewer/re_space_view_time_series/src/point_visualizer_system.rs +++ b/crates/viewer/re_space_view_time_series/src/point_visualizer_system.rs @@ -38,10 +38,15 @@ const DEFAULT_MARKER_SIZE: f32 = 3.0; impl VisualizerSystem for SeriesPointSystem { fn visualizer_query_info(&self) -> VisualizerQueryInfo { let mut query_info = VisualizerQueryInfo::from_archetype::(); - query_info - .queried - .extend(SeriesPoint::all_components().iter().map(ToOwned::to_owned)); + query_info.queried.extend( + SeriesPoint::all_components() + .iter() + .map(|descr| descr.component_name), + ); + + use re_types::ComponentBatch as _; query_info.indicators = std::iter::once(SeriesPoint::indicator().name()).collect(); + query_info } diff --git a/crates/viewer/re_time_panel/tests/time_panel_tests.rs b/crates/viewer/re_time_panel/tests/time_panel_tests.rs index 362161b75a5c5..19052452c24d0 100644 --- a/crates/viewer/re_time_panel/tests/time_panel_tests.rs +++ b/crates/viewer/re_time_panel/tests/time_panel_tests.rs @@ -24,7 +24,7 @@ pub fn time_panel_two_sections_should_match_snapshot() { builder = builder.with_sparse_component_batches( RowId::new(), [build_frame_nr(frame)], - [(MyPoint::name(), Some(&points1 as _))], + [(MyPoint::descriptor(), Some(&points1 as _))], ); } test_context @@ -61,7 +61,7 @@ pub fn time_panel_dense_data_should_match_snapshot() { builder = builder.with_sparse_component_batches( RowId::new(), [build_frame_nr(frame)], - [(MyPoint::name(), Some(&points1 as _))], + [(MyPoint::descriptor(), Some(&points1 as _))], ); } test_context diff --git a/crates/viewer/re_viewer_context/src/blueprint_helpers.rs b/crates/viewer/re_viewer_context/src/blueprint_helpers.rs index d447a74a811e4..ac0265998a386 100644 --- a/crates/viewer/re_viewer_context/src/blueprint_helpers.rs +++ b/crates/viewer/re_viewer_context/src/blueprint_helpers.rs @@ -1,7 +1,7 @@ use re_chunk::{Arrow2Array, RowId}; use re_chunk_store::external::re_chunk::Chunk; use re_log_types::{EntityPath, TimeInt, TimePoint, Timeline}; -use re_types::{AsComponents, ComponentBatch, ComponentName}; +use re_types::{AsComponents, ComponentBatch, ComponentDescriptor, ComponentName}; use crate::{StoreContext, SystemCommand, SystemCommandSender as _, ViewerContext}; @@ -91,7 +91,11 @@ impl ViewerContext<'_> { let timepoint = self.store_context.blueprint_timepoint_for_writes(); let chunk = match Chunk::builder(entity_path.clone()) - .with_row(RowId::new(), timepoint.clone(), [(component_name, array)]) + .with_row( + RowId::new(), + timepoint.clone(), + [(ComponentDescriptor::new(component_name), array)], + ) .build() { Ok(chunk) => chunk, @@ -174,7 +178,7 @@ impl ViewerContext<'_> { RowId::new(), timepoint, [( - component_name, + ComponentDescriptor::new(component_name), re_chunk::external::arrow2::array::new_empty_array(datatype), )], ) diff --git a/crates/viewer/re_viewer_context/src/item.rs b/crates/viewer/re_viewer_context/src/item.rs index 951e74ec57c4b..9802dc79233d0 100644 --- a/crates/viewer/re_viewer_context/src/item.rs +++ b/crates/viewer/re_viewer_context/src/item.rs @@ -1,5 +1,6 @@ use re_entity_db::{EntityDb, InstancePath}; use re_log_types::{ComponentPath, DataPath, EntityPath}; +use re_types::ComponentDescriptor; use crate::{ContainerId, SpaceViewId}; @@ -201,7 +202,11 @@ pub fn resolve_mono_instance_path( for component_name in component_names { if let Some(array) = engine .cache() - .latest_at(query, &instance.entity_path, [component_name]) + .latest_at( + query, + &instance.entity_path, + [ComponentDescriptor::new(component_name)], + ) .component_batch_raw(&component_name) { if array.len() > 1 { diff --git a/crates/viewer/re_viewer_context/src/space_view/visualizer_entity_subscriber.rs b/crates/viewer/re_viewer_context/src/space_view/visualizer_entity_subscriber.rs index 4a376e8305f2a..20b2dafcd1dae 100644 --- a/crates/viewer/re_viewer_context/src/space_view/visualizer_entity_subscriber.rs +++ b/crates/viewer/re_viewer_context/src/space_view/visualizer_entity_subscriber.rs @@ -184,8 +184,11 @@ impl ChunkStoreSubscriber for VisualizerEntitySubscriber { continue; } - for (component_name, list_array) in event.diff.chunk.components() { - if let Some(index) = self.required_components_indices.get(component_name) { + for (component_desc, list_array) in event.diff.chunk.components().iter_flattened() { + if let Some(index) = self + .required_components_indices + .get(&component_desc.component_name) + { // The component might be present, but logged completely empty. // That shouldn't count towards filling "having the required component present"! // (Note: This happens frequently now with `Transform3D`'s component which always get logged, thus tripping of the `AxisLengthDetector`!)` ) diff --git a/crates/viewer/re_viewer_context/src/space_view/visualizer_system.rs b/crates/viewer/re_viewer_context/src/space_view/visualizer_system.rs index 10eec441f9407..97f8eaf9dee7b 100644 --- a/crates/viewer/re_viewer_context/src/space_view/visualizer_system.rs +++ b/crates/viewer/re_viewer_context/src/space_view/visualizer_system.rs @@ -55,13 +55,17 @@ pub struct VisualizerQueryInfo { impl VisualizerQueryInfo { pub fn from_archetype() -> Self { + use re_types_core::ComponentBatch as _; Self { indicators: std::iter::once(T::indicator().name()).collect(), required: T::required_components() .iter() - .map(ToOwned::to_owned) + .map(|descr| descr.component_name) + .collect(), + queried: T::all_components() + .iter() + .map(|descr| descr.component_name) .collect(), - queried: T::all_components().iter().map(ToOwned::to_owned).collect(), } } diff --git a/crates/viewer/re_viewport_blueprint/src/container.rs b/crates/viewer/re_viewport_blueprint/src/container.rs index 1d31614375445..f2eb4cc83c88a 100644 --- a/crates/viewer/re_viewport_blueprint/src/container.rs +++ b/crates/viewer/re_viewport_blueprint/src/container.rs @@ -68,9 +68,7 @@ impl ContainerBlueprint { let results = blueprint_db.storage_engine().cache().latest_at( query, &id.as_entity_path(), - blueprint_archetypes::ContainerBlueprint::all_components() - .iter() - .copied(), + blueprint_archetypes::ContainerBlueprint::all_components().iter(), ); // This is a required component. Note that when loading containers we crawl the subtree and so diff --git a/crates/viewer/re_viewport_blueprint/src/space_view.rs b/crates/viewer/re_viewport_blueprint/src/space_view.rs index 4ebdd42cd85e2..505a8eb02eaf7 100644 --- a/crates/viewer/re_viewport_blueprint/src/space_view.rs +++ b/crates/viewer/re_viewport_blueprint/src/space_view.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use ahash::HashMap; use itertools::{FoldWhile, Itertools}; use parking_lot::Mutex; -use re_types::SpaceViewClassIdentifier; +use re_types::{ComponentDescriptor, SpaceViewClassIdentifier}; use re_chunk::{Chunk, RowId}; use re_chunk_store::LatestAtQuery; @@ -135,9 +135,7 @@ impl SpaceViewBlueprint { let results = blueprint_db.storage_engine().cache().latest_at( query, &id.as_entity_path(), - blueprint_archetypes::SpaceViewBlueprint::all_components() - .iter() - .copied(), + blueprint_archetypes::SpaceViewBlueprint::all_components().iter(), ); // This is a required component. Note that when loading space-views we crawl the subtree and so @@ -268,17 +266,18 @@ impl SpaceViewBlueprint { .flat_map(|v| v.into_iter()) // It's important that we don't include the SpaceViewBlueprint's components // since those will be updated separately and may contain different data. - .filter(|component| { + .filter(|component_name| { *path != current_path || !blueprint_archetypes::SpaceViewBlueprint::all_components() - .contains(component) + .iter() + .any(|descr| descr.component_name == *component_name) }) .filter_map(|component_name| { let array = blueprint_engine .cache() .latest_at(query, path, [component_name]) .component_batch_raw(&component_name); - array.map(|array| (component_name, array)) + array.map(|array| (ComponentDescriptor::new(component_name), array)) }), ) .build(); diff --git a/crates/viewer/re_viewport_blueprint/src/view_properties.rs b/crates/viewer/re_viewport_blueprint/src/view_properties.rs index 2216e84555a14..f31ac4b8db26b 100644 --- a/crates/viewer/re_viewport_blueprint/src/view_properties.rs +++ b/crates/viewer/re_viewport_blueprint/src/view_properties.rs @@ -51,7 +51,10 @@ impl ViewProperty { blueprint_query.clone(), view_id, A::name(), - A::all_components().as_ref(), + A::all_components() + .iter() + .map(|descr| descr.component_name) + .collect(), ) } @@ -60,7 +63,7 @@ impl ViewProperty { blueprint_query: LatestAtQuery, space_view_id: SpaceViewId, archetype_name: ArchetypeName, - component_names: &[ComponentName], + component_names: Vec, ) -> Self { let blueprint_store_path = entity_path_for_view_property(space_view_id, blueprint_db.tree(), archetype_name); @@ -75,7 +78,7 @@ impl ViewProperty { blueprint_store_path, archetype_name, query_results, - component_names: component_names.to_vec(), + component_names, blueprint_query, } } diff --git a/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs b/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs index 239865b244040..93570bce16ee6 100644 --- a/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs +++ b/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs @@ -89,9 +89,7 @@ impl ViewportBlueprint { let results = blueprint_engine.cache().latest_at( query, &VIEWPORT_PATH.into(), - blueprint_archetypes::ViewportBlueprint::all_components() - .iter() - .copied(), + blueprint_archetypes::ViewportBlueprint::all_components().iter(), ); let blueprint_archetypes::ViewportBlueprint { diff --git a/docs/snippets/Cargo.toml b/docs/snippets/Cargo.toml index 27c32511e5889..304533df299bf 100644 --- a/docs/snippets/Cargo.toml +++ b/docs/snippets/Cargo.toml @@ -6,20 +6,27 @@ rust-version.workspace = true license.workspace = true publish = false + [lints] workspace = true + [dependencies] +rerun = { path = "../../crates/top/rerun" } + ndarray.workspace = true rand = { workspace = true, features = ["std", "std_rng"] } rand_distr = { workspace = true, features = ["std"] } -rerun = { path = "../../crates/top/rerun" } +similar-asserts.workspace = true + [build-dependencies] -itertools.workspace = true re_build_tools.workspace = true + +itertools.workspace = true rust-format.workspace = true + [package.metadata.cargo-machete] # false positives because they aren't used until codegen is run: ignored = ["ndarray", "rand", "rand_distr", "rerun"] diff --git a/docs/snippets/all/archetypes/manual_indicator.rs b/docs/snippets/all/archetypes/manual_indicator.rs index eea5009d506a5..c5c66ce393133 100644 --- a/docs/snippets/all/archetypes/manual_indicator.rs +++ b/docs/snippets/all/archetypes/manual_indicator.rs @@ -10,8 +10,8 @@ fn main() -> Result<(), Box> { rec.log( "points_and_mesh", &[ - rerun::Points3D::indicator().as_ref() as &dyn rerun::ComponentBatch, - rerun::Mesh3D::indicator().as_ref(), + &rerun::Points3D::indicator() as &dyn rerun::ComponentBatch, + &rerun::Mesh3D::indicator() as _, &[[0.0, 0.0, 0.0], [10.0, 0.0, 0.0], [0.0, 10.0, 0.0]].map(rerun::Position3D::from), &[[255, 0, 0], [0, 255, 0], [0, 0, 255]] .map(|[r, g, b]| rerun::Color::from_rgb(r, g, b)), diff --git a/docs/snippets/all/descriptors/descr_builtin_archetype.rs b/docs/snippets/all/descriptors/descr_builtin_archetype.rs new file mode 100644 index 0000000000000..ff4a0e1c2bb89 --- /dev/null +++ b/docs/snippets/all/descriptors/descr_builtin_archetype.rs @@ -0,0 +1,65 @@ +use rerun::{ChunkStore, ChunkStoreConfig, ComponentDescriptor, VersionPolicy}; + +#[allow(clippy::unwrap_used)] +fn main() -> Result<(), Box> { + const APP_ID: &str = "rerun_example_descriptors_builtin_archetype_vanilla"; + + let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?; + + rec.log_static( + "data", + &rerun::Points3D::new([(1.0, 2.0, 3.0)]).with_radii([0.3, 0.2, 0.1]), + )?; + + // When this snippet runs through the snippet comparison machinery, this environment variable + // will point to the output RRD. + // We can thus load this RRD to check that the proper tags were indeed forwarded. + // + // Python and C++ are indirectly checked by the snippet comparison tool itself. + if let Ok(path_to_rrd) = std::env::var("_RERUN_TEST_FORCE_SAVE") { + rec.flush_blocking(); + + let stores = ChunkStore::from_rrd_filepath( + &ChunkStoreConfig::ALL_DISABLED, + path_to_rrd, + VersionPolicy::Warn, + )?; + assert_eq!(1, stores.len()); + + let store = stores.into_values().next().unwrap(); + let chunks = store.iter_chunks().collect::>(); + assert_eq!(1, chunks.len()); + + let chunk = chunks.into_iter().next().unwrap(); + + let mut descriptors = chunk + .components() + .values() + .flat_map(|per_desc| per_desc.keys()) + .cloned() + .collect::>(); + descriptors.sort(); + + let expected = vec![ + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: None, + component_name: "rerun.components.Points3DIndicator".into(), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some("positions".into()), + component_name: "rerun.components.Position3D".into(), + }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Points3D".into()), + archetype_field_name: Some("radii".into()), + component_name: "rerun.components.Radius".into(), + }, + ]; + + similar_asserts::assert_eq!(expected, descriptors); + } + + Ok(()) +} diff --git a/docs/snippets/all/descriptors/descr_builtin_component.rs b/docs/snippets/all/descriptors/descr_builtin_component.rs new file mode 100644 index 0000000000000..a453bf858e27c --- /dev/null +++ b/docs/snippets/all/descriptors/descr_builtin_component.rs @@ -0,0 +1,56 @@ +use rerun::{ChunkStore, ChunkStoreConfig, Component as _, ComponentDescriptor, VersionPolicy}; + +#[allow(clippy::unwrap_used)] +fn main() -> Result<(), Box> { + const APP_ID: &str = "rerun_example_descriptors_builtin_component_vanilla"; + + let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?; + + rec.log_component_batches( + "data", + true, + [&rerun::components::Position3D::new(1.0, 2.0, 3.0) as &dyn rerun::ComponentBatch], + )?; + + // When this snippet runs through the snippet comparison machinery, this environment variable + // will point to the output RRD. + // We can thus load this RRD to check that the proper tags were indeed forwarded. + // + // Python and C++ are indirectly checked by the snippet comparison tool itself. + if let Ok(path_to_rrd) = std::env::var("_RERUN_TEST_FORCE_SAVE") { + rec.flush_blocking(); + + let stores = ChunkStore::from_rrd_filepath( + &ChunkStoreConfig::ALL_DISABLED, + path_to_rrd, + VersionPolicy::Warn, + )?; + assert_eq!(1, stores.len()); + + let store = stores.into_values().next().unwrap(); + let chunks = store.iter_chunks().collect::>(); + assert_eq!(1, chunks.len()); + + let chunk = chunks.into_iter().next().unwrap(); + + let mut descriptors = chunk + .components() + .values() + .flat_map(|per_desc| per_desc.keys()) + .cloned() + .collect::>(); + descriptors.sort(); + + let expected = vec![ + ComponentDescriptor { + archetype_name: None, + archetype_field_name: None, + component_name: rerun::components::Position3D::name(), + }, // + ]; + + similar_asserts::assert_eq!(expected, descriptors); + } + + Ok(()) +} diff --git a/docs/snippets/all/descriptors/descr_custom_archetype.rs b/docs/snippets/all/descriptors/descr_custom_archetype.rs new file mode 100644 index 0000000000000..7f2b56a7efbb1 --- /dev/null +++ b/docs/snippets/all/descriptors/descr_custom_archetype.rs @@ -0,0 +1,138 @@ +use rerun::{ + external::arrow2, ChunkStore, ChunkStoreConfig, Component, ComponentDescriptor, VersionPolicy, +}; + +#[derive(Debug, Clone, Copy)] +struct CustomPosition3D(rerun::components::Position3D); + +impl rerun::SizeBytes for CustomPosition3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } +} + +impl rerun::Loggable for CustomPosition3D { + #[inline] + fn arrow2_datatype() -> arrow2::datatypes::DataType { + rerun::components::Position3D::arrow2_datatype() + } + + #[inline] + fn to_arrow2_opt<'a>( + data: impl IntoIterator>>>, + ) -> rerun::SerializationResult> + where + Self: 'a, + { + rerun::components::Position3D::to_arrow2_opt( + data.into_iter().map(|opt| opt.map(Into::into).map(|c| c.0)), + ) + } +} + +impl rerun::Component for CustomPosition3D { + #[inline] + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("user.CustomPosition3D") + } +} + +struct CustomPoints3D { + positions: Vec, + colors: Option>, +} + +impl CustomPoints3D { + fn indicator() -> rerun::NamedIndicatorComponent { + rerun::NamedIndicatorComponent("user.CustomPoints3DIndicator".into()) + } + + fn overridden_position_descriptor() -> ComponentDescriptor { + CustomPosition3D::descriptor() + .or_with_archetype_name(|| "user.CustomArchetype".into()) + .or_with_archetype_field_name(|| "positions".into()) + } + + fn overridden_color_descriptor() -> ComponentDescriptor { + rerun::components::Color::descriptor() + .or_with_archetype_name(|| "user.CustomArchetype".into()) + .or_with_archetype_field_name(|| "colors".into()) + } +} + +impl rerun::AsComponents for CustomPoints3D { + fn as_component_batches(&self) -> Vec> { + [ + Some(Self::indicator().to_batch()), + Some( + rerun::MaybeOwnedComponentBatch::new(&self.positions as &dyn rerun::ComponentBatch) + .with_descriptor_override(Self::overridden_position_descriptor()), + ), + self.colors.as_ref().map(|colors| { + rerun::MaybeOwnedComponentBatch::new(colors as &dyn rerun::ComponentBatch) + .with_descriptor_override(Self::overridden_color_descriptor()) + }), + ] + .into_iter() + .flatten() + .collect() + } +} + +#[allow(clippy::unwrap_used)] +fn main() -> Result<(), Box> { + const APP_ID: &str = "rerun_example_descriptors_custom_component_vanilla"; + + let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?; + + let position = CustomPosition3D(rerun::components::Position3D::new(1.0, 2.0, 3.0)); + let color = rerun::components::Color::new(0xFF00FFFF); + + let points = CustomPoints3D { + positions: vec![position], + colors: Some(vec![color]), + }; + + rec.log_static("data", &points as _)?; + + // When this snippet runs through the snippet comparison machinery, this environment variable + // will point to the output RRD. + // We can thus load this RRD to check that the proper tags were indeed forwarded. + // + // Python and C++ are indirectly checked by the snippet comparison tool itself. + if let Ok(path_to_rrd) = std::env::var("_RERUN_TEST_FORCE_SAVE") { + rec.flush_blocking(); + + let stores = ChunkStore::from_rrd_filepath( + &ChunkStoreConfig::ALL_DISABLED, + path_to_rrd, + VersionPolicy::Warn, + )?; + assert_eq!(1, stores.len()); + + let store = stores.into_values().next().unwrap(); + let chunks = store.iter_chunks().collect::>(); + assert_eq!(1, chunks.len()); + + let chunk = chunks.into_iter().next().unwrap(); + + let mut descriptors = chunk + .components() + .values() + .flat_map(|per_desc| per_desc.keys()) + .cloned() + .collect::>(); + descriptors.sort(); + + let expected = vec![ + rerun::ComponentBatch::descriptor(&CustomPoints3D::indicator()).into_owned(), + CustomPoints3D::overridden_color_descriptor(), + CustomPoints3D::overridden_position_descriptor(), + ]; + + similar_asserts::assert_eq!(expected, descriptors); + } + + Ok(()) +} diff --git a/docs/snippets/all/descriptors/descr_custom_component.rs b/docs/snippets/all/descriptors/descr_custom_component.rs new file mode 100644 index 0000000000000..52fa8bb316b14 --- /dev/null +++ b/docs/snippets/all/descriptors/descr_custom_component.rs @@ -0,0 +1,90 @@ +use rerun::{ + external::arrow2, ChunkStore, ChunkStoreConfig, Component, ComponentDescriptor, Loggable, + VersionPolicy, +}; + +#[derive(Debug, Clone, Copy)] +struct CustomPosition3D(rerun::components::Position3D); + +impl rerun::SizeBytes for CustomPosition3D { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } +} + +impl Loggable for CustomPosition3D { + #[inline] + fn arrow2_datatype() -> arrow2::datatypes::DataType { + rerun::components::Position3D::arrow2_datatype() + } + + #[inline] + fn to_arrow2_opt<'a>( + data: impl IntoIterator>>>, + ) -> rerun::SerializationResult> + where + Self: 'a, + { + rerun::components::Position3D::to_arrow2_opt( + data.into_iter().map(|opt| opt.map(Into::into).map(|c| c.0)), + ) + } +} + +impl Component for CustomPosition3D { + #[inline] + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor { + archetype_name: Some("user.CustomArchetype".into()), + archetype_field_name: Some("user.CustomArchetypeField".into()), + component_name: "user.CustomPosition3D".into(), + } + } +} + +#[allow(clippy::unwrap_used)] +fn main() -> Result<(), Box> { + const APP_ID: &str = "rerun_example_descriptors_custom_component_vanilla"; + + let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?; + + let position = CustomPosition3D(rerun::components::Position3D::new(1.0, 2.0, 3.0)); + rec.log_component_batches("data", true, [&position as &dyn rerun::ComponentBatch])?; + + // When this snippet runs through the snippet comparison machinery, this environment variable + // will point to the output RRD. + // We can thus load this RRD to check that the proper tags were indeed forwarded. + // + // Python and C++ are indirectly checked by the snippet comparison tool itself. + if let Ok(path_to_rrd) = std::env::var("_RERUN_TEST_FORCE_SAVE") { + rec.flush_blocking(); + + let stores = ChunkStore::from_rrd_filepath( + &ChunkStoreConfig::ALL_DISABLED, + path_to_rrd, + VersionPolicy::Warn, + )?; + assert_eq!(1, stores.len()); + + let store = stores.into_values().next().unwrap(); + let chunks = store.iter_chunks().collect::>(); + assert_eq!(1, chunks.len()); + + let chunk = chunks.into_iter().next().unwrap(); + + let mut descriptors = chunk + .components() + .values() + .flat_map(|per_desc| per_desc.keys()) + .cloned() + .collect::>(); + descriptors.sort(); + + let expected = vec![CustomPosition3D::descriptor()]; + + similar_asserts::assert_eq!(expected, descriptors); + } + + Ok(()) +} diff --git a/docs/snippets/all/tutorials/custom_data.rs b/docs/snippets/all/tutorials/custom_data.rs index 751270bf98f56..44785ab502ffb 100644 --- a/docs/snippets/all/tutorials/custom_data.rs +++ b/docs/snippets/all/tutorials/custom_data.rs @@ -3,7 +3,7 @@ use rerun::{ demo_util::grid, external::{arrow2, glam, re_types}, - ComponentName, + ComponentBatch, }; // --- @@ -26,9 +26,17 @@ impl rerun::AsComponents for CustomPoints3D { .chain( [ Some(indicator.to_batch()), - self.confidences - .as_ref() - .map(|v| (v as &dyn rerun::ComponentBatch).into()), + self.confidences.as_ref().map(|batch| { + rerun::MaybeOwnedComponentBatch::new(batch as &dyn rerun::ComponentBatch) + // Optionally override the descriptor with extra information. + .with_descriptor_override( + batch + .descriptor() + .into_owned() + .or_with_archetype_name(|| "user.CustomPoints3D".into()) + .or_with_archetype_field_name(|| "confidences".into()), + ) + }), ] .into_iter() .flatten(), @@ -75,8 +83,8 @@ impl rerun::Loggable for Confidence { impl rerun::Component for Confidence { #[inline] - fn name() -> ComponentName { - "user.Confidence".into() + fn descriptor() -> rerun::ComponentDescriptor { + rerun::ComponentDescriptor::new("user.Confidence") } } diff --git a/docs/snippets/snippets.toml b/docs/snippets/snippets.toml index 1934bfcaf9be2..f18b515e55262 100644 --- a/docs/snippets/snippets.toml +++ b/docs/snippets/snippets.toml @@ -54,6 +54,22 @@ "cpp", "rust", ] +"descriptors/descr_builtin_archetype" = [ # Python and C++ not yet supported (next PRs) + "cpp", + "py", +] +"descriptors/descr_builtin_component" = [ # Python and C++ not yet supported (next PRs) + "cpp", + "py", +] +"descriptors/descr_custom_archetype" = [ # Python and C++ not yet supported (next PRs) + "cpp", + "py", +] +"descriptors/descr_custom_component" = [ # Python and C++ not yet supported (next PRs) + "cpp", + "py", +] views = [ "cpp", # TODO(#5520): C++ views are not yet implemented "rust", # TODO(#5521): Rust views are not yet implemented diff --git a/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs b/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs index 979d06551e80c..695195c3c2507 100644 --- a/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs +++ b/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs @@ -2,7 +2,7 @@ use re_viewer::external::{ egui, re_log_types::{EntityPath, Instance}, re_renderer, - re_types::{self, components::Color, Component as _, ComponentName}, + re_types::{self, components::Color, Component as _, ComponentDescriptor}, re_viewer_context::{ self, IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewContext, ViewContextCollection, ViewQuery, ViewSystemIdentifier, VisualizerQueryInfo, @@ -34,8 +34,8 @@ impl re_types::Archetype for ColorArchetype { "Instance Color" } - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { - vec![re_types::components::Color::name()].into() + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + vec![re_types::components::Color::descriptor()].into() } } diff --git a/examples/rust/dataframe_query/src/main.rs b/examples/rust/dataframe_query/src/main.rs index d451c830da932..a7ca32ecae85d 100644 --- a/examples/rust/dataframe_query/src/main.rs +++ b/examples/rust/dataframe_query/src/main.rs @@ -53,6 +53,8 @@ fn main() -> Result<(), Box> { continue; } + // engine.engine.read().store().iter_chunks() + let query = QueryExpression { filtered_index: Some(timeline), view_contents: Some( diff --git a/examples/rust/dna/src/main.rs b/examples/rust/dna/src/main.rs index 2017ccb405cde..396e19141dc27 100644 --- a/examples/rust/dna/src/main.rs +++ b/examples/rust/dna/src/main.rs @@ -7,6 +7,7 @@ use itertools::Itertools as _; use rerun::{ demo_util::{bounce_lerp, color_spiral}, external::glam, + ComponentBatch, }; const NUM_POINTS: usize = 100; @@ -17,6 +18,12 @@ fn main() -> Result<(), Box> { let (points1, colors1) = color_spiral(NUM_POINTS, 2.0, 0.02, 0.0, 0.1); let (points2, colors2) = color_spiral(NUM_POINTS, 2.0, 0.02, TAU * 0.5, 0.1); + rec.log_component_batches( + "data", + true, + [&rerun::components::Position3D::new(1.0, 2.0, 3.0) as &dyn ComponentBatch], + )?; + rec.set_time_seconds("stable_time", 0f64); rec.log_static( diff --git a/rerun_py/src/arrow.rs b/rerun_py/src/arrow.rs index 8677c66a6d80f..83d1118e6296f 100644 --- a/rerun_py/src/arrow.rs +++ b/rerun_py/src/arrow.rs @@ -17,7 +17,7 @@ use pyo3::{ use re_chunk::{Chunk, ChunkError, ChunkId, PendingRow, RowId, TimeColumn}; use re_log_types::TimePoint; -use re_sdk::{external::nohash_hasher::IntMap, ComponentName, EntityPath, Timeline}; +use re_sdk::{external::nohash_hasher::IntMap, ComponentDescriptor, EntityPath, Timeline}; /// Perform conversion between a pyarrow array to arrow2 types. /// @@ -59,7 +59,7 @@ pub fn build_row_from_components( let components = arrays .into_iter() .zip(fields) - .map(|(value, field)| (field.name.into(), value)) + .map(|(value, field)| (ComponentDescriptor::new(field.name), value)) .collect(); Ok(PendingRow { @@ -149,11 +149,11 @@ pub fn build_chunk_from_components( )? }; - Ok((field.name.into(), batch)) + Ok((ComponentDescriptor::new(field.name), batch)) }) .collect(); - let components: IntMap> = components + let components = components .map_err(|err| PyRuntimeError::new_err(format!("Error converting component data: {err}")))? .into_iter() .collect();