From af2482b18153021de9a7cb384fd90cf78c6be676 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Wed, 14 Jun 2023 11:12:34 +0200 Subject: [PATCH] addressing PR comments --- .../re_types/definitions/arrow/attributes.fbs | 4 ++-- .../definitions/python/attributes.fbs | 6 ++--- .../definitions/rerun/archetypes/points2d.fbs | 20 ++++++++--------- .../re_types/definitions/rerun/attributes.fbs | 8 +++---- .../definitions/rerun/components/class_id.fbs | 10 ++++----- .../definitions/rerun/components/color.fbs | 12 +++++----- .../rerun/components/draw_order.fbs | 12 +++++----- .../rerun/components/instance_key.fbs | 10 ++++----- .../rerun/components/keypoint_id.fbs | 10 ++++----- .../definitions/rerun/components/label.fbs | 10 ++++----- .../definitions/rerun/components/point2d.fbs | 12 +++++----- .../definitions/rerun/components/radius.fbs | 10 ++++----- .../definitions/rerun/datatypes/vec2d.fbs | 6 ++--- .../re_types/definitions/rust/attributes.fbs | 8 +++---- crates/re_types/source_hash.txt | 2 +- crates/re_types_builder/src/arrow_registry.rs | 6 ++--- crates/re_types_builder/src/codegen/python.rs | 8 +++---- crates/re_types_builder/src/codegen/rust.rs | 16 +++++++------- crates/re_types_builder/src/lib.rs | 22 +++++++++---------- 19 files changed, 96 insertions(+), 96 deletions(-) diff --git a/crates/re_types/definitions/arrow/attributes.fbs b/crates/re_types/definitions/arrow/attributes.fbs index f8e96e4d8bad..1a32ea66be33 100644 --- a/crates/re_types/definitions/arrow/attributes.fbs +++ b/crates/re_types/definitions/arrow/attributes.fbs @@ -6,7 +6,7 @@ namespace arrow; /// matter that only impacts (de)serialization. /// /// Only applies to unions. -attribute "arrow.attr.sparse_union"; +attribute "attr.arrow.sparse_union"; /// Marks a single-field object as transparent, affecting its Arrow datatype. /// @@ -14,4 +14,4 @@ attribute "arrow.attr.sparse_union"; /// matter that only impacts (de)serialization. /// /// This is generally most useful for getting rid of extraneous `struct` layers. -attribute "arrow.attr.transparent"; +attribute "attr.arrow.transparent"; diff --git a/crates/re_types/definitions/python/attributes.fbs b/crates/re_types/definitions/python/attributes.fbs index 4160bdc0c429..c24923751719 100644 --- a/crates/re_types/definitions/python/attributes.fbs +++ b/crates/re_types/definitions/python/attributes.fbs @@ -3,14 +3,14 @@ namespace python.attributes; /// Marks a field as transparent, meaning its type will be replaced by the underlying type. /// /// Only applies to fields whose type is an object with a single-field. -attribute "python.attr.transparent"; +attribute "attr.python.transparent"; /// Defines the type aliases for a component, e.g. the types that make up `ComponentLike`. /// /// Only applies to structs/unions that are components. -attribute "python.attr.aliases"; +attribute "attr.python.aliases"; /// Defines the array type aliases for a component, e.g. the types that make up `ComponentArrayLike`. /// /// Only applies to structs/unions that are components. -attribute "python.attr.array_aliases"; +attribute "attr.python.array_aliases"; diff --git a/crates/re_types/definitions/rerun/archetypes/points2d.fbs b/crates/re_types/definitions/rerun/archetypes/points2d.fbs index 746a179965d5..d3c97df80b81 100644 --- a/crates/re_types/definitions/rerun/archetypes/points2d.fbs +++ b/crates/re_types/definitions/rerun/archetypes/points2d.fbs @@ -9,44 +9,44 @@ namespace rerun.archetypes; // TODO(#2371): archetype IDL definitions must always be tables // TODO(#2372): archetype IDL definitions must refer to objects of kind component -// TODO(#2373): `rerun.attr.component_required` implies `required` +// TODO(#2373): `attr.rerun.component_required` implies `required` /// A 2D point cloud with positions and optional colors, radii, labels, etc. table Points2D ( - "rust.attr.derive": "Debug, Clone, PartialEq", + "attr.rust.derive": "Debug, Clone, PartialEq", order: 100 ) { // --- Required --- /// All the actual 2D points that make up the point cloud. - points: [rerun.components.Point2D] ("rerun.attr.component_required", required, order: 1000); + points: [rerun.components.Point2D] ("attr.rerun.component_required", required, order: 1000); // --- Recommended --- /// Optional radii for the points, effectively turning them into circles. - radii: [rerun.components.Radius] ("rerun.attr.component_recommended", order: 2000); + radii: [rerun.components.Radius] ("attr.rerun.component_recommended", order: 2000); /// Optional colors for the points. /// /// \python The colors are interpreted as RGB or RGBA in sRGB gamma-space, /// \python As either 0-1 floats or 0-255 integers, with separate alpha. - colors: [rerun.components.Color] ("rerun.attr.component_recommended", order: 2100); + colors: [rerun.components.Color] ("attr.rerun.component_recommended", order: 2100); // --- Optional --- /// Optional text labels for the points. - labels: [rerun.components.Label] ("rerun.attr.component_optional", order: 3000); + labels: [rerun.components.Label] ("attr.rerun.component_optional", order: 3000); /// An optional floating point value that specifies the 2D drawing order. /// Objects with higher values are drawn on top of those with lower values. /// /// The default for 2D points is 30.0. - draw_order: rerun.components.DrawOrder ("rerun.attr.component_optional", order: 3100); + draw_order: rerun.components.DrawOrder ("attr.rerun.component_optional", order: 3100); /// Optional class Ids for the points. /// /// The class ID provides colors and labels if not specified explicitly. - class_ids: [rerun.components.ClassId] ("rerun.attr.component_optional", order: 3200); + class_ids: [rerun.components.ClassId] ("attr.rerun.component_optional", order: 3200); /// Optional keypoint IDs for the points, identifying them within a class. /// @@ -56,8 +56,8 @@ table Points2D ( /// with `class_id`). /// E.g. the classification might be 'Person' and the keypoints refer to joints on a /// detected skeleton. - keypoint_ids: [rerun.components.KeypointId] ("rerun.attr.component_optional", order: 3300); + keypoint_ids: [rerun.components.KeypointId] ("attr.rerun.component_optional", order: 3300); /// Unique identifiers for each individual point in the batch. - instance_keys: [rerun.components.InstanceKey] ("rerun.attr.component_optional", order: 3400); + instance_keys: [rerun.components.InstanceKey] ("attr.rerun.component_optional", order: 3400); } diff --git a/crates/re_types/definitions/rerun/attributes.fbs b/crates/re_types/definitions/rerun/attributes.fbs index 3cc2c2519f91..5d77bfe5c640 100644 --- a/crates/re_types/definitions/rerun/attributes.fbs +++ b/crates/re_types/definitions/rerun/attributes.fbs @@ -4,16 +4,16 @@ namespace rerun.attributes; /// backend-specific ways. /// /// Only applies to the fields of an archetype. -attribute "rerun.attr.component_required"; +attribute "attr.rerun.component_required"; /// Marks a component as recommended, which is likely to impact the generated code in /// backend-specific ways. /// /// Only applies to the fields of an archetype. -attribute "rerun.attr.component_recommended"; +attribute "attr.rerun.component_recommended"; /// Marks a component as optional, which is likely to impact the generated code in -/// ways. +/// backend-specific ways. /// /// Only applies to the fields of an archetype. -attribute "rerun.attr.component_optional"; +attribute "attr.rerun.component_optional"; diff --git a/crates/re_types/definitions/rerun/components/class_id.fbs b/crates/re_types/definitions/rerun/components/class_id.fbs index 12b96f224a5a..56af2d50936c 100644 --- a/crates/re_types/definitions/rerun/components/class_id.fbs +++ b/crates/re_types/definitions/rerun/components/class_id.fbs @@ -12,11 +12,11 @@ namespace rerun.components; /// /// \rs Used to look up a `crate::components::ClassDescription` within the `crate::components::AnnotationContext`. struct ClassId ( - "arrow.attr.transparent", - "python.attr.aliases": "float", - "python.attr.array_aliases": "npt.NDArray[np.uint8], npt.NDArray[np.uint16], npt.NDArray[np.uint32]", - "rust.attr.derive": "Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash", - "rust.attr.tuple_struct", + "attr.arrow.transparent", + "attr.python.aliases": "float", + "attr.python.array_aliases": "npt.NDArray[np.uint8], npt.NDArray[np.uint16], npt.NDArray[np.uint32]", + "attr.rust.derive": "Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash", + "attr.rust.tuple_struct", order: 100 ) { id: ushort; diff --git a/crates/re_types/definitions/rerun/components/color.fbs b/crates/re_types/definitions/rerun/components/color.fbs index 483515843f67..ec4bef2f2d44 100644 --- a/crates/re_types/definitions/rerun/components/color.fbs +++ b/crates/re_types/definitions/rerun/components/color.fbs @@ -11,12 +11,12 @@ namespace rerun.components; /// An RGBA color tuple with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. struct Color ( - "arrow.attr.transparent", - "python.attr.aliases": "Sequence[int], Sequence[float], npt.NDArray[np.uint8], npt.NDArray[np.float32], npt.NDArray[np.float64]", - "python.attr.array_aliases": "Sequence[int], Sequence[float], npt.NDArray[np.uint8], npt.NDArray[np.float32], npt.NDArray[np.float64]", - "rust.attr.derive": "Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, bytemuck::Pod, bytemuck::Zeroable", - "rust.attr.repr": "transparent", - "rust.attr.tuple_struct", + "attr.arrow.transparent", + "attr.python.aliases": "Sequence[int], Sequence[float], npt.NDArray[np.uint8], npt.NDArray[np.float32], npt.NDArray[np.float64]", + "attr.python.array_aliases": "Sequence[int], Sequence[float], npt.NDArray[np.uint8], npt.NDArray[np.float32], npt.NDArray[np.float64]", + "attr.rust.derive": "Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, bytemuck::Pod, bytemuck::Zeroable", + "attr.rust.repr": "transparent", + "attr.rust.tuple_struct", order: 100 ) { rgba: uint; diff --git a/crates/re_types/definitions/rerun/components/draw_order.fbs b/crates/re_types/definitions/rerun/components/draw_order.fbs index d17feae36bd2..819fb82f26e6 100644 --- a/crates/re_types/definitions/rerun/components/draw_order.fbs +++ b/crates/re_types/definitions/rerun/components/draw_order.fbs @@ -17,12 +17,12 @@ namespace rerun.components; /// /// Draw order for entities with the same draw order is generally undefined. struct DrawOrder ( - "arrow.attr.transparent", - "python.attr.aliases": "float", - "python.attr.array_aliases": "npt.NDArray[np.float32]", - "rust.attr.derive": "Debug, Clone, Copy, PartialEq, PartialOrd", - "rust.attr.repr": "transparent", - "rust.attr.tuple_struct", + "attr.arrow.transparent", + "attr.python.aliases": "float", + "attr.python.array_aliases": "npt.NDArray[np.float32]", + "attr.rust.derive": "Debug, Clone, Copy, PartialEq, PartialOrd", + "attr.rust.repr": "transparent", + "attr.rust.tuple_struct", order: 100 ) { value: float; diff --git a/crates/re_types/definitions/rerun/components/instance_key.fbs b/crates/re_types/definitions/rerun/components/instance_key.fbs index 77002e48467f..4f9e74096b0e 100644 --- a/crates/re_types/definitions/rerun/components/instance_key.fbs +++ b/crates/re_types/definitions/rerun/components/instance_key.fbs @@ -11,11 +11,11 @@ namespace rerun.components; /// A unique numeric identifier for each individual instance within a batch. struct InstanceKey ( - "arrow.attr.transparent", - "python.attr.aliases": "int", - "python.attr.array_aliases": "npt.NDArray[np.uint64]", - "rust.attr.tuple_struct", - "rust.attr.derive": "Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord", + "attr.arrow.transparent", + "attr.python.aliases": "int", + "attr.python.array_aliases": "npt.NDArray[np.uint64]", + "attr.rust.tuple_struct", + "attr.rust.derive": "Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord", order: 100 ) { value: uint64; diff --git a/crates/re_types/definitions/rerun/components/keypoint_id.fbs b/crates/re_types/definitions/rerun/components/keypoint_id.fbs index a0f5f0ce483c..1db9c09f5b63 100644 --- a/crates/re_types/definitions/rerun/components/keypoint_id.fbs +++ b/crates/re_types/definitions/rerun/components/keypoint_id.fbs @@ -19,11 +19,11 @@ namespace rerun.components; /// \rs /// \rs Used to look up an `crate::components::AnnotationInfo` for a Keypoint within the `crate::components::AnnotationContext`. struct KeypointId ( - "arrow.attr.transparent", - "python.attr.aliases": "float", - "python.attr.array_aliases": "npt.NDArray[np.uint8], npt.NDArray[np.uint16], npt.NDArray[np.uint32]", - "rust.attr.derive": "Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash", - "rust.attr.tuple_struct", + "attr.arrow.transparent", + "attr.python.aliases": "float", + "attr.python.array_aliases": "npt.NDArray[np.uint8], npt.NDArray[np.uint16], npt.NDArray[np.uint32]", + "attr.rust.derive": "Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash", + "attr.rust.tuple_struct", order: 200 ) { id: ushort; diff --git a/crates/re_types/definitions/rerun/components/label.fbs b/crates/re_types/definitions/rerun/components/label.fbs index ad70138af361..2e77637c4c53 100644 --- a/crates/re_types/definitions/rerun/components/label.fbs +++ b/crates/re_types/definitions/rerun/components/label.fbs @@ -11,11 +11,11 @@ namespace rerun.components; /// A String label component. table Label ( - "arrow.attr.transparent", - "python.attr.aliases": "str", - "rust.attr.derive": "Debug, Clone, PartialEq, Eq, PartialOrd, Ord", - "rust.attr.repr": "transparent", - "rust.attr.tuple_struct", + "attr.arrow.transparent", + "attr.python.aliases": "str", + "attr.rust.derive": "Debug, Clone, PartialEq, Eq, PartialOrd, Ord", + "attr.rust.repr": "transparent", + "attr.rust.tuple_struct", order: 100 ) { value: string (required, order: 100); diff --git a/crates/re_types/definitions/rerun/components/point2d.fbs b/crates/re_types/definitions/rerun/components/point2d.fbs index a75496bd00cd..f32ab6dd389d 100644 --- a/crates/re_types/definitions/rerun/components/point2d.fbs +++ b/crates/re_types/definitions/rerun/components/point2d.fbs @@ -11,15 +11,15 @@ namespace rerun.components; /// A point in 2D space. struct Point2D ( - "arrow.attr.transparent", - "python.attr.aliases": "npt.NDArray[np.float32], Sequence[float], Tuple[float, float]", - "python.attr.array_aliases": "npt.NDArray[np.float32], Sequence[float]", - "rust.attr.tuple_struct", - "rust.attr.derive": "Debug, Default, Clone, Copy, PartialEq, PartialOrd", + "attr.arrow.transparent", + "attr.python.aliases": "npt.NDArray[np.float32], Sequence[float], Tuple[float, float]", + "attr.python.array_aliases": "npt.NDArray[np.float32], Sequence[float]", + "attr.rust.tuple_struct", + "attr.rust.derive": "Debug, Default, Clone, Copy, PartialEq, PartialOrd", order: 100 ) { position: rerun.datatypes.Vec2D ( - "python.attr.transparent", + "attr.python.transparent", order: 100 ); } diff --git a/crates/re_types/definitions/rerun/components/radius.fbs b/crates/re_types/definitions/rerun/components/radius.fbs index cfa68c185885..052244aa8ca9 100644 --- a/crates/re_types/definitions/rerun/components/radius.fbs +++ b/crates/re_types/definitions/rerun/components/radius.fbs @@ -11,11 +11,11 @@ namespace rerun.components; /// A Radius component. struct Radius ( - "arrow.attr.transparent", - "python.attr.aliases": "float", - "python.attr.array_aliases": "npt.NDArray[np.float32]", - "rust.attr.tuple_struct", - "rust.attr.derive": "Debug, Clone, Copy, PartialEq, PartialOrd", + "attr.arrow.transparent", + "attr.python.aliases": "float", + "attr.python.array_aliases": "npt.NDArray[np.float32]", + "attr.rust.tuple_struct", + "attr.rust.derive": "Debug, Clone, Copy, PartialEq, PartialOrd", order: 100 ) { value: float; diff --git a/crates/re_types/definitions/rerun/datatypes/vec2d.fbs b/crates/re_types/definitions/rerun/datatypes/vec2d.fbs index db6f976820e7..9fc31cbb3f18 100644 --- a/crates/re_types/definitions/rerun/datatypes/vec2d.fbs +++ b/crates/re_types/definitions/rerun/datatypes/vec2d.fbs @@ -8,9 +8,9 @@ namespace rerun.datatypes; /// A vector in 2D space. struct Vec2D ( - "arrow.attr.transparent", - "rust.attr.derive": "Debug, Default, Clone, Copy, PartialEq, PartialOrd", - "rust.attr.tuple_struct", + "attr.arrow.transparent", + "attr.rust.derive": "Debug, Default, Clone, Copy, PartialEq, PartialOrd", + "attr.rust.tuple_struct", order: 100 ) { xy: [float: 2]; diff --git a/crates/re_types/definitions/rust/attributes.fbs b/crates/re_types/definitions/rust/attributes.fbs index 58a8fac6b070..eba209568488 100644 --- a/crates/re_types/definitions/rust/attributes.fbs +++ b/crates/re_types/definitions/rust/attributes.fbs @@ -3,13 +3,13 @@ namespace rust.attributes; /// Apply to a struct or table object to generate a tuple struct. /// /// The type definition of the target object must have exactly a single field. -attribute "rust.attr.tuple_struct"; +attribute "attr.rust.tuple_struct"; /// Apply to any object to generate a #derive clause. /// /// The value of the attribute will be trimmed out but otherwise left as-is. -/// E.g. "rust.attr.derive": "Debug, Clone, Copy"`. -attribute "rust.attr.derive"; +/// E.g. "attr.rust.derive": "Debug, Clone, Copy"`. +attribute "attr.rust.derive"; /// Apply to any object to generate a #repr clause with the specified value. -attribute "rust.attr.repr"; +attribute "attr.rust.repr"; diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 488de92a5d7d..fdbfe6cf0c48 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -dae77f291d1698807cd865265cbb77731bd1aedf07c0968a6b0ac67c18f94590 +95c13226f31d47e4639e155fc80ee6830579c50e38ee1d997b4bda4d23ba03b6 \ No newline at end of file diff --git a/crates/re_types_builder/src/arrow_registry.rs b/crates/re_types_builder/src/arrow_registry.rs index 505d0ccd253a..4a59b18bac0c 100644 --- a/crates/re_types_builder/src/arrow_registry.rs +++ b/crates/re_types_builder/src/arrow_registry.rs @@ -4,7 +4,7 @@ use anyhow::Context as _; use arrow2::datatypes::{DataType, Field, UnionMode}; use std::collections::{BTreeMap, HashMap}; -use crate::{ElementType, Object, Type, ARROW_ATTR_SPARSE_UNION, ARROW_ATTR_TRANSPARENT}; +use crate::{ElementType, Object, Type, ATTR_ARROW_SPARSE_UNION, ATTR_ARROW_TRANSPARENT}; // --- Registry --- @@ -50,7 +50,7 @@ impl ArrowRegistry { fn arrow_datatype_from_object(&self, obj: &Object) -> LazyDatatype { let is_struct = obj.is_struct(); - let is_transparent = obj.try_get_attr::(ARROW_ATTR_TRANSPARENT).is_some(); + let is_transparent = obj.try_get_attr::(ATTR_ARROW_TRANSPARENT).is_some(); let num_fields = obj.fields.len(); assert!( @@ -79,7 +79,7 @@ impl ArrowRegistry { ) } else { let is_sparse = obj - .try_get_attr::(ARROW_ATTR_SPARSE_UNION) + .try_get_attr::(ATTR_ARROW_SPARSE_UNION) .is_some(); LazyDatatype::Extension( obj.fqname.clone(), diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index a695cbee5970..37df314ed9e6 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -10,7 +10,7 @@ use std::{ use crate::{ codegen::{StringExt as _, AUTOGEN_WARNING}, ArrowRegistry, CodeGenerator, Docs, ElementType, Object, ObjectField, ObjectKind, Objects, - Type, PYTHON_ATTR_ALIASES, PYTHON_ATTR_ARRAY_ALIASES, PYTHON_ATTR_TRANSPARENT, + Type, ATTR_PYTHON_ALIASES, ATTR_PYTHON_ARRAY_ALIASES, ATTR_PYTHON_TRANSPARENT, }; // --- @@ -544,9 +544,9 @@ fn quote_str_method_from_obj(objects: &Objects, obj: &Object) -> String { fn quote_aliases_from_object(obj: &Object) -> String { assert!(obj.kind != ObjectKind::Archetype); - let aliases = obj.try_get_attr::(PYTHON_ATTR_ALIASES); + let aliases = obj.try_get_attr::(ATTR_PYTHON_ALIASES); let array_aliases = obj - .try_get_attr::(PYTHON_ATTR_ARRAY_ALIASES) + .try_get_attr::(ATTR_PYTHON_ARRAY_ALIASES) .unwrap_or_default(); let name = &obj.name; @@ -682,7 +682,7 @@ fn quote_field_type_from_field( // agnostic) in a python specific quoting function... a static helper at the very least // would be nice. let is_transparent = field - .try_get_attr::(PYTHON_ATTR_TRANSPARENT) + .try_get_attr::(ATTR_PYTHON_TRANSPARENT) .is_some(); if is_transparent { let target = objects.get(fqname); diff --git a/crates/re_types_builder/src/codegen/rust.rs b/crates/re_types_builder/src/codegen/rust.rs index ae87dedf9398..9e78c7a984ec 100644 --- a/crates/re_types_builder/src/codegen/rust.rs +++ b/crates/re_types_builder/src/codegen/rust.rs @@ -10,8 +10,8 @@ use std::{ use crate::{ codegen::{StringExt as _, AUTOGEN_WARNING}, ArrowRegistry, CodeGenerator, Docs, ElementType, Object, ObjectField, ObjectKind, Objects, - Type, RERUN_ATTR_COMPONENT_OPTIONAL, RERUN_ATTR_COMPONENT_RECOMMENDED, - RERUN_ATTR_COMPONENT_REQUIRED, RUST_ATTR_DERIVE, RUST_ATTR_REPR, RUST_ATTR_TUPLE_STRUCT, + Type, ATTR_RERUN_COMPONENT_OPTIONAL, ATTR_RERUN_COMPONENT_RECOMMENDED, + ATTR_RERUN_COMPONENT_REQUIRED, ATTR_RUST_DERIVE, ATTR_RUST_REPR, ATTR_RUST_TUPLE_STRUCT, }; // --- @@ -392,19 +392,19 @@ fn quote_type_from_element_type(typ: &ElementType) -> String { } fn quote_derive_clause_from_obj(obj: &Object) -> Option { - obj.try_get_attr::(RUST_ATTR_DERIVE) + obj.try_get_attr::(ATTR_RUST_DERIVE) .map(|what| format!("#[derive({what})]")) } fn quote_repr_clause_from_obj(obj: &Object) -> Option { - obj.try_get_attr::(RUST_ATTR_REPR) + obj.try_get_attr::(ATTR_RUST_REPR) .map(|what| format!("#[repr({what})]")) } fn is_tuple_struct_from_obj(obj: &Object) -> bool { obj.is_struct() && obj.fields.len() == 1 - && obj.try_get_attr::(RUST_ATTR_TUPLE_STRUCT).is_some() + && obj.try_get_attr::(ATTR_RUST_TUPLE_STRUCT).is_some() } fn quote_trait_impls_from_obj(arrow_registry: &ArrowRegistry, obj: &Object) -> String { @@ -471,10 +471,10 @@ fn quote_trait_impls_from_obj(arrow_registry: &ArrowRegistry, obj: &Object) -> S (num_components, components) } - let (num_required, required) = compute_components(obj, RERUN_ATTR_COMPONENT_REQUIRED); + let (num_required, required) = compute_components(obj, ATTR_RERUN_COMPONENT_REQUIRED); let (num_recommended, recommended) = - compute_components(obj, RERUN_ATTR_COMPONENT_RECOMMENDED); - let (num_optional, optional) = compute_components(obj, RERUN_ATTR_COMPONENT_OPTIONAL); + compute_components(obj, ATTR_RERUN_COMPONENT_RECOMMENDED); + let (num_optional, optional) = compute_components(obj, ATTR_RERUN_COMPONENT_OPTIONAL); let num_all = num_required + num_recommended + num_optional; let all = [required.as_str(), recommended.as_str(), optional.as_str()] diff --git a/crates/re_types_builder/src/lib.rs b/crates/re_types_builder/src/lib.rs index 0637a3e34c25..ded329c85506 100644 --- a/crates/re_types_builder/src/lib.rs +++ b/crates/re_types_builder/src/lib.rs @@ -101,20 +101,20 @@ pub use self::objects::{ // --- Attributes --- -pub const ARROW_ATTR_TRANSPARENT: &str = "arrow.attr.transparent"; -pub const ARROW_ATTR_SPARSE_UNION: &str = "arrow.attr.sparse_union"; +pub const ATTR_ARROW_TRANSPARENT: &str = "attr.arrow.transparent"; +pub const ATTR_ARROW_SPARSE_UNION: &str = "attr.arrow.sparse_union"; -pub const RERUN_ATTR_COMPONENT_REQUIRED: &str = "rerun.attr.component_required"; -pub const RERUN_ATTR_COMPONENT_RECOMMENDED: &str = "rerun.attr.component_recommended"; -pub const RERUN_ATTR_COMPONENT_OPTIONAL: &str = "rerun.attr.component_optional"; +pub const ATTR_RERUN_COMPONENT_REQUIRED: &str = "attr.rerun.component_required"; +pub const ATTR_RERUN_COMPONENT_RECOMMENDED: &str = "attr.rerun.component_recommended"; +pub const ATTR_RERUN_COMPONENT_OPTIONAL: &str = "attr.rerun.component_optional"; -pub const PYTHON_ATTR_TRANSPARENT: &str = "python.attr.transparent"; -pub const PYTHON_ATTR_ALIASES: &str = "python.attr.aliases"; -pub const PYTHON_ATTR_ARRAY_ALIASES: &str = "python.attr.array_aliases"; +pub const ATTR_PYTHON_TRANSPARENT: &str = "attr.python.transparent"; +pub const ATTR_PYTHON_ALIASES: &str = "attr.python.aliases"; +pub const ATTR_PYTHON_ARRAY_ALIASES: &str = "attr.python.array_aliases"; -pub const RUST_ATTR_DERIVE: &str = "rust.attr.derive"; -pub const RUST_ATTR_REPR: &str = "rust.attr.repr"; -pub const RUST_ATTR_TUPLE_STRUCT: &str = "rust.attr.tuple_struct"; +pub const ATTR_RUST_DERIVE: &str = "attr.rust.derive"; +pub const ATTR_RUST_REPR: &str = "attr.rust.repr"; +pub const ATTR_RUST_TUPLE_STRUCT: &str = "attr.rust.tuple_struct"; // --- Entrypoints ---