Skip to content

ComponentBatch doesn't implement AsComponents anymore #8820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions crates/build/re_types_builder/src/codegen/rust/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ fn generate_object_file(
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::{ComponentDescriptor, ComponentName};\n");
code.push_str("use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor, SerializedComponentBatch};\n");
code.push_str("use ::re_types_core::{ComponentBatch, SerializedComponentBatch};\n");

// NOTE: `TokenStream`s discard whitespacing information by definition, so we need to
// inject some of our own when writing to file… while making sure that don't inject
Expand Down Expand Up @@ -1174,7 +1174,7 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream {

let all_component_batches = {
std::iter::once(quote! {
Self::indicator().serialized()
Some(Self::indicator())
})
.chain(obj.fields.iter().map(|obj_field| {
let field_name = format_ident!("{}", obj_field.name);
Expand Down Expand Up @@ -1244,9 +1244,9 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream {
}

#[inline]
fn indicator() -> ComponentBatchCowWithDescriptor<'static> {
static INDICATOR: #quoted_indicator_name = #quoted_indicator_name::DEFAULT;
ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch)
fn indicator() -> SerializedComponentBatch {
#[allow(clippy::unwrap_used)] // There is no such thing as failing to serialize an indicator.
#quoted_indicator_name::DEFAULT.serialized().unwrap()
}

#[inline]
Expand Down Expand Up @@ -1665,8 +1665,7 @@ fn quote_builder_from_obj(reporter: &Reporter, objects: &Objects, obj: &Object)
I: IntoIterator<Item = usize> + Clone,
{
let columns = [ #(#fields),* ];
let indicator_column = #indicator_column;
Ok(columns.into_iter().chain([indicator_column]).flatten())
Ok(columns.into_iter().flatten().chain([#indicator_column]))
}

#columns_unary_doc
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_data_loader/src/loader_archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn load_video(
std::iter::once((video_timeline, time_column)).collect(),
[
(
VideoFrameReference::indicator().descriptor().into_owned(),
VideoFrameReference::indicator().descriptor.clone(),
video_frame_reference_indicators_list_array,
),
(
Expand Down
7 changes: 7 additions & 0 deletions crates/store/re_log_types/src/example_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ impl MyPoints {
impl re_types_core::Archetype for MyPoints {
type Indicator = re_types_core::GenericIndicatorComponent<Self>;

fn indicator() -> SerializedComponentBatch {
use re_types_core::ComponentBatch as _;
// These is no such thing as failing to serialized an indicator.
#[allow(clippy::unwrap_used)]
Self::Indicator::default().serialized().unwrap()
}

fn name() -> re_types_core::ArchetypeName {
"example.MyPoints".into()
}
Expand Down
19 changes: 11 additions & 8 deletions crates/store/re_types/src/archetypes/annotation_context.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions crates/store/re_types/src/archetypes/arrows2d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions crates/store/re_types/src/archetypes/arrows3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions crates/store/re_types/src/archetypes/asset3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions crates/store/re_types/src/archetypes/asset_video.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions crates/store/re_types/src/archetypes/bar_chart.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions crates/store/re_types/src/archetypes/boxes2d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading