Replace MarkerShape with code-generated enum type#5336
Conversation
| /// The top-level description of the Viewport. | ||
| table ContainerBlueprint ( | ||
| "attr.rerun.scope": "blueprint", | ||
| "attr.rust.derive": "Default", |
There was a problem hiding this comment.
The old code had a bug, which defaulted the container_kind to the invalid value 0
|
You shouldn't need an extra attribute to find the associated enum type.
E.g.: diff --git a/crates/re_types_builder/src/objects.rs b/crates/re_types_builder/src/objects.rs
index 07d1f0fb38..e1d32f5516 100644
--- a/crates/re_types_builder/src/objects.rs
+++ b/crates/re_types_builder/src/objects.rs
@@ -795,6 +795,7 @@ impl ObjectField {
let attrs = Attributes::from_raw_attrs(field.attributes());
+ dbg!(enums[field.type_().index() as usize]);
let typ = if let Some(enum_type) = attrs.try_get(&fqname, crate::ATTR_ENUM_TYPE) {
// Hack needed because flattbuffers report fields of enum types as integers.
Type::Object(enum_type) |
teh-cmc
left a comment
There was a problem hiding this comment.
Looks great except for that superfluous enum_type attribute and the miscellaneous hacks that come with it.
| "attr.rust.derive": "PartialEq, Eq, PartialOrd, Copy", | ||
| "attr.rust.repr": "transparent" | ||
| enum MarkerShape: byte ( | ||
| "attr.docs.unreleased" |
There was a problem hiding this comment.
The generated doclink changes from https://docs.rs/re_types/latest/re_types/components/struct.MarkerShape.html to https://docs.rs/re_types/latest/re_types/components/enum.MarkerShape.html which doesn't exist (yet)
What
enumin codegen to specify constant-constants #3384Also replaces
Corner2DandContainerKind, but those are blueprint only and thus not user facing (yet).The user-facing code should stay mostly the same.
I also improved the generated documentation for all components and datatypes
Checklist
mainbuild: app.rerun.ionightlybuild: app.rerun.io