Skip to content
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

Make tagged columnar updates work with mono-components too #8769

Merged
merged 4 commits into from
Jan 22, 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
22 changes: 22 additions & 0 deletions crates/build/re_types_builder/src/codegen/rust/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1876,13 +1876,35 @@ fn quote_builder_from_obj(reporter: &Reporter, objects: &Objects, obj: &Object)
}
}
} else {
let quoted_many = obj.scope().is_none().then(|| {
let method_name_many = format_ident!("with_many_{field_name}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with_many_scalar is a bit bumpy 🤔
Can't come up with anything better either though. English's 's' pluralization is too imperfect and we don't want to change field names...
Well at least it stands out and the doc string then tells you what's up 👍

let docstring_many = unindent::unindent(&format!("\
This method makes it possible to pack multiple [`{typ}`] in a single component batch.

This only makes sense when used in conjunction with [`Self::columns`]. [`Self::{method_name}`] should
be used when logging a single row's worth of data.
"));
let docstring_many = quote_doc_lines(&docstring_many.lines().map(|l| l.to_owned()).collect_vec());

quote !{
#docstring_many
#[inline]
pub fn #method_name_many(mut self, #field_name: impl IntoIterator<Item = impl Into<#typ>>) -> Self {
self.#field_name = try_serialize_field(Self::#descr_fn_name(), #field_name);
self
}
}
});

quote! {
#docstring
#[inline]
pub fn #method_name(mut self, #field_name: impl Into<#typ>) -> Self {
self.#field_name = try_serialize_field(Self::#descr_fn_name(), [#field_name]);
self
}

#quoted_many
}
}
});
Expand Down
26 changes: 26 additions & 0 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.

13 changes: 13 additions & 0 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.

26 changes: 26 additions & 0 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.

13 changes: 13 additions & 0 deletions crates/store/re_types/src/archetypes/capsules3d.rs

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

92 changes: 92 additions & 0 deletions crates/store/re_types/src/archetypes/depth_image.rs

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

26 changes: 26 additions & 0 deletions crates/store/re_types/src/archetypes/ellipsoids3d.rs

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

Loading
Loading