diff --git a/crates/re_types/definitions/rerun/archetypes.fbs b/crates/re_types/definitions/rerun/archetypes.fbs index 3b8c926f33a2..ae295878f3f4 100644 --- a/crates/re_types/definitions/rerun/archetypes.fbs +++ b/crates/re_types/definitions/rerun/archetypes.fbs @@ -1,3 +1,5 @@ include "./archetypes/points2d.fbs"; +include "./testing/archetypes/fuzzy.fbs"; + namespace rerun.archetypes; diff --git a/crates/re_types/definitions/rerun/testing/archetypes/fuzzy.fbs b/crates/re_types/definitions/rerun/testing/archetypes/fuzzy.fbs new file mode 100644 index 000000000000..2484542f52c2 --- /dev/null +++ b/crates/re_types/definitions/rerun/testing/archetypes/fuzzy.fbs @@ -0,0 +1,50 @@ +include "fbs/attributes.fbs"; + +include "rerun/testing/components/fuzzy.fbs"; + +namespace rerun.testing.archetypes; + +// --- + +// TODO(cmc): we actually have an opportunity to resolve the nullability situation here if we make +// component_required vs. required do different things: +// - component_required affects the nullability of the component itself at the archetype level (as it does today) +// - required affects the nullability of the element values for the underlying array (both native and arrow) + +table AffixFuzzer1 ( + "attr.rust.derive": "Debug, Clone, PartialEq", + order: 100 +) { + fuzz1001: rerun.testing.components.AffixFuzzer1 ("attr.rerun.component_required", required, order: 1001); + fuzz1002: rerun.testing.components.AffixFuzzer2 ("attr.rerun.component_required", required, order: 1002); + fuzz1003: rerun.testing.components.AffixFuzzer3 ("attr.rerun.component_required", required, order: 1003); + fuzz1004: rerun.testing.components.AffixFuzzer4 ("attr.rerun.component_required", required, order: 1004); + fuzz1005: rerun.testing.components.AffixFuzzer5 ("attr.rerun.component_required", required, order: 1005); + fuzz1006: rerun.testing.components.AffixFuzzer6 ("attr.rerun.component_required", required, order: 1006); + fuzz1007: rerun.testing.components.AffixFuzzer7 ("attr.rerun.component_required", required, order: 1007); + + fuzz1101: [rerun.testing.components.AffixFuzzer1] ("attr.rerun.component_required", required, order: 1101); + fuzz1102: [rerun.testing.components.AffixFuzzer2] ("attr.rerun.component_required", required, order: 1102); + fuzz1103: [rerun.testing.components.AffixFuzzer3] ("attr.rerun.component_required", required, order: 1103); + fuzz1104: [rerun.testing.components.AffixFuzzer4] ("attr.rerun.component_required", required, order: 1104); + fuzz1105: [rerun.testing.components.AffixFuzzer5] ("attr.rerun.component_required", required, order: 1105); + fuzz1106: [rerun.testing.components.AffixFuzzer6] ("attr.rerun.component_required", required, order: 1106); + fuzz1107: [rerun.testing.components.AffixFuzzer7] ("attr.rerun.component_required", required, order: 1107); + + fuzz2001: rerun.testing.components.AffixFuzzer1 ("attr.rerun.component_optional", order: 2001); + fuzz2002: rerun.testing.components.AffixFuzzer2 ("attr.rerun.component_optional", order: 2002); + fuzz2003: rerun.testing.components.AffixFuzzer3 ("attr.rerun.component_optional", order: 2003); + fuzz2004: rerun.testing.components.AffixFuzzer4 ("attr.rerun.component_optional", order: 2004); + fuzz2005: rerun.testing.components.AffixFuzzer5 ("attr.rerun.component_optional", order: 2005); + fuzz2006: rerun.testing.components.AffixFuzzer6 ("attr.rerun.component_optional", order: 2006); + fuzz2007: rerun.testing.components.AffixFuzzer7 ("attr.rerun.component_optional", order: 2007); + + fuzz2101: [rerun.testing.components.AffixFuzzer1] ("attr.rerun.component_optional", order: 2101); + fuzz2102: [rerun.testing.components.AffixFuzzer2] ("attr.rerun.component_optional", order: 2102); + fuzz2103: [rerun.testing.components.AffixFuzzer3] ("attr.rerun.component_optional", order: 2103); + fuzz2104: [rerun.testing.components.AffixFuzzer4] ("attr.rerun.component_optional", order: 2104); + fuzz2105: [rerun.testing.components.AffixFuzzer5] ("attr.rerun.component_optional", order: 2105); + fuzz2106: [rerun.testing.components.AffixFuzzer6] ("attr.rerun.component_optional", order: 2106); + fuzz2107: [rerun.testing.components.AffixFuzzer7] ("attr.rerun.component_optional", order: 2107); +} + diff --git a/crates/re_types/definitions/rerun/testing/components/fuzzy.fbs b/crates/re_types/definitions/rerun/testing/components/fuzzy.fbs new file mode 100644 index 000000000000..e8610f9c4a11 --- /dev/null +++ b/crates/re_types/definitions/rerun/testing/components/fuzzy.fbs @@ -0,0 +1,72 @@ +include "arrow/attributes.fbs"; +include "fbs/attributes.fbs"; +include "rust/attributes.fbs"; + +include "rerun/testing/datatypes/fuzzy.fbs"; + +namespace rerun.testing.components; + +// --- + +table AffixFuzzer1 ( + "attr.arrow.transparent", + "attr.rust.derive": "Debug, Clone, PartialEq", + order: 100 +) { + single_required: rerun.testing.datatypes.AffixFuzzer1 (required); +} + +table AffixFuzzer2 ( + "attr.arrow.transparent", + "attr.rust.derive": "Debug, Clone, PartialEq", + "attr.rust.tuple_struct", + order: 200 +) { + single_required: rerun.testing.datatypes.AffixFuzzer1 (required); +} + +table AffixFuzzer3 ( + "attr.rust.derive": "Debug, Clone, PartialEq", + order: 300 +) { + single_required: rerun.testing.datatypes.AffixFuzzer1 (required); +} + +table AffixFuzzer4 ( + "attr.arrow.transparent", + "attr.rust.derive": "Debug, Clone, PartialEq", + order: 400 +) { + single_optional: rerun.testing.datatypes.AffixFuzzer1; +} + +table AffixFuzzer5 ( + "attr.arrow.transparent", + "attr.rust.derive": "Debug, Clone, PartialEq", + "attr.rust.tuple_struct", + order: 500 +) { + single_optional: rerun.testing.datatypes.AffixFuzzer1; +} + +table AffixFuzzer6 ( + "attr.rust.derive": "Debug, Clone, PartialEq", + order: 600 +) { + single_optional: rerun.testing.datatypes.AffixFuzzer1; +} + +table AffixFuzzer7 ( + "attr.rust.derive": "Debug, Clone, PartialEq", + order: 700 +) { + many_optional: [rerun.testing.datatypes.AffixFuzzer1] (order: 100); + single_float_optional: float (order: 101); + single_string_required: string (order: 102, required); + single_string_optional: string (order: 103); + many_floats_optional: [float] (order: 104); + many_strings_required: [string] (order: 105, required); + many_strings_optional: [string] (order: 106); + // TODO(cmc): the ugly bug we need to take care of at some point + // many_transparent_optionals: rerun.testing.datatypes.AffixFuzzer2 (order: 107); +} diff --git a/crates/re_types/definitions/rerun/testing/datatypes/fuzzy.fbs b/crates/re_types/definitions/rerun/testing/datatypes/fuzzy.fbs new file mode 100644 index 000000000000..3588b55af442 --- /dev/null +++ b/crates/re_types/definitions/rerun/testing/datatypes/fuzzy.fbs @@ -0,0 +1,28 @@ +include "arrow/attributes.fbs"; +include "fbs/attributes.fbs"; +include "rust/attributes.fbs"; + +namespace rerun.testing.datatypes; + +// --- + +table AffixFuzzer1 ( + "attr.rust.derive": "Debug, Clone, PartialEq", + order: 100 +) { + single_float_optional: float (order: 101); + single_string_required: string (order: 102, required); + single_string_optional: string (order: 103); + many_floats_optional: [float] (order: 104); + many_strings_required: [string] (order: 105, required); + many_strings_optional: [string] (order: 106); +} + +table AffixFuzzer2 ( + "attr.arrow.transparent", + "attr.rust.derive": "Debug, Clone, PartialEq", + "attr.rust.tuple_struct", + order: 200 +) { + single_float_optional: float (order: 101); +} diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 076ec5a0f013..15cae3431078 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. -ffa869371b5fc08da6c80ce53a84db674682b38152c458d958649decc8949f35 \ No newline at end of file +32b9eccc275777c29b252374ea6dcd69a3f1a48c42ae79aa5138ec2556526b52 \ No newline at end of file diff --git a/crates/re_types/src/archetypes/fuzzy.rs b/crates/re_types/src/archetypes/fuzzy.rs new file mode 100644 index 000000000000..a4cb29782f0b --- /dev/null +++ b/crates/re_types/src/archetypes/fuzzy.rs @@ -0,0 +1,274 @@ +// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. + +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer1 { + pub fuzz1001: crate::components::AffixFuzzer1, + pub fuzz1002: crate::components::AffixFuzzer2, + pub fuzz1003: crate::components::AffixFuzzer3, + pub fuzz1004: crate::components::AffixFuzzer4, + pub fuzz1005: crate::components::AffixFuzzer5, + pub fuzz1006: crate::components::AffixFuzzer6, + pub fuzz1007: crate::components::AffixFuzzer7, + pub fuzz1101: Vec, + pub fuzz1102: Vec, + pub fuzz1103: Vec, + pub fuzz1104: Vec, + pub fuzz1105: Vec, + pub fuzz1106: Vec, + pub fuzz1107: Vec, + pub fuzz2001: Option, + pub fuzz2002: Option, + pub fuzz2003: Option, + pub fuzz2004: Option, + pub fuzz2005: Option, + pub fuzz2006: Option, + pub fuzz2007: Option, + pub fuzz2101: Option>, + pub fuzz2102: Option>, + pub fuzz2103: Option>, + pub fuzz2104: Option>, + pub fuzz2105: Option>, + pub fuzz2106: Option>, + pub fuzz2107: Option>, +} + +impl AffixFuzzer1 { + pub const REQUIRED_COMPONENTS: [crate::ComponentName; 14usize] = [ + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7"), + ]; + + pub const RECOMMENDED_COMPONENTS: [crate::ComponentName; 0usize] = []; + + pub const OPTIONAL_COMPONENTS: [crate::ComponentName; 14usize] = [ + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7"), + ]; + + pub const ALL_COMPONENTS: [crate::ComponentName; 28usize] = [ + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6"), + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7"), + ]; +} + +impl crate::Archetype for AffixFuzzer1 { + fn name() -> crate::ArchetypeName { + crate::ArchetypeName::Borrowed("rerun.testing.archetypes.AffixFuzzer1") + } + + fn required_components() -> Vec { + Self::REQUIRED_COMPONENTS.to_vec() + } + + fn recommended_components() -> Vec { + Self::RECOMMENDED_COMPONENTS.to_vec() + } + + fn optional_components() -> Vec { + Self::OPTIONAL_COMPONENTS.to_vec() + } + + #[allow(clippy::todo)] + fn to_arrow_datatypes() -> Vec { + todo!("query the registry for all fqnames"); + } +} + +impl AffixFuzzer1 { + pub fn new( + fuzz1001: impl Into, + fuzz1002: impl Into, + fuzz1003: impl Into, + fuzz1004: impl Into, + fuzz1005: impl Into, + fuzz1006: impl Into, + fuzz1007: impl Into, + fuzz1101: impl IntoIterator>, + fuzz1102: impl IntoIterator>, + fuzz1103: impl IntoIterator>, + fuzz1104: impl IntoIterator>, + fuzz1105: impl IntoIterator>, + fuzz1106: impl IntoIterator>, + fuzz1107: impl IntoIterator>, + ) -> Self { + Self { + fuzz1001: fuzz1001.into(), + fuzz1002: fuzz1002.into(), + fuzz1003: fuzz1003.into(), + fuzz1004: fuzz1004.into(), + fuzz1005: fuzz1005.into(), + fuzz1006: fuzz1006.into(), + fuzz1007: fuzz1007.into(), + fuzz1101: fuzz1101.into_iter().map(Into::into).collect(), + fuzz1102: fuzz1102.into_iter().map(Into::into).collect(), + fuzz1103: fuzz1103.into_iter().map(Into::into).collect(), + fuzz1104: fuzz1104.into_iter().map(Into::into).collect(), + fuzz1105: fuzz1105.into_iter().map(Into::into).collect(), + fuzz1106: fuzz1106.into_iter().map(Into::into).collect(), + fuzz1107: fuzz1107.into_iter().map(Into::into).collect(), + fuzz2001: None, + fuzz2002: None, + fuzz2003: None, + fuzz2004: None, + fuzz2005: None, + fuzz2006: None, + fuzz2007: None, + fuzz2101: None, + fuzz2102: None, + fuzz2103: None, + fuzz2104: None, + fuzz2105: None, + fuzz2106: None, + fuzz2107: None, + } + } + + pub fn with_fuzz2001(mut self, fuzz2001: impl Into) -> Self { + self.fuzz2001 = Some(fuzz2001.into()); + self + } + + pub fn with_fuzz2002(mut self, fuzz2002: impl Into) -> Self { + self.fuzz2002 = Some(fuzz2002.into()); + self + } + + pub fn with_fuzz2003(mut self, fuzz2003: impl Into) -> Self { + self.fuzz2003 = Some(fuzz2003.into()); + self + } + + pub fn with_fuzz2004(mut self, fuzz2004: impl Into) -> Self { + self.fuzz2004 = Some(fuzz2004.into()); + self + } + + pub fn with_fuzz2005(mut self, fuzz2005: impl Into) -> Self { + self.fuzz2005 = Some(fuzz2005.into()); + self + } + + pub fn with_fuzz2006(mut self, fuzz2006: impl Into) -> Self { + self.fuzz2006 = Some(fuzz2006.into()); + self + } + + pub fn with_fuzz2007(mut self, fuzz2007: impl Into) -> Self { + self.fuzz2007 = Some(fuzz2007.into()); + self + } + + pub fn with_fuzz2101( + mut self, + fuzz2101: impl IntoIterator>, + ) -> Self { + self.fuzz2101 = Some(fuzz2101.into_iter().map(Into::into).collect()); + self + } + + pub fn with_fuzz2102( + mut self, + fuzz2102: impl IntoIterator>, + ) -> Self { + self.fuzz2102 = Some(fuzz2102.into_iter().map(Into::into).collect()); + self + } + + pub fn with_fuzz2103( + mut self, + fuzz2103: impl IntoIterator>, + ) -> Self { + self.fuzz2103 = Some(fuzz2103.into_iter().map(Into::into).collect()); + self + } + + pub fn with_fuzz2104( + mut self, + fuzz2104: impl IntoIterator>, + ) -> Self { + self.fuzz2104 = Some(fuzz2104.into_iter().map(Into::into).collect()); + self + } + + pub fn with_fuzz2105( + mut self, + fuzz2105: impl IntoIterator>, + ) -> Self { + self.fuzz2105 = Some(fuzz2105.into_iter().map(Into::into).collect()); + self + } + + pub fn with_fuzz2106( + mut self, + fuzz2106: impl IntoIterator>, + ) -> Self { + self.fuzz2106 = Some(fuzz2106.into_iter().map(Into::into).collect()); + self + } + + pub fn with_fuzz2107( + mut self, + fuzz2107: impl IntoIterator>, + ) -> Self { + self.fuzz2107 = Some(fuzz2107.into_iter().map(Into::into).collect()); + self + } +} diff --git a/crates/re_types/src/archetypes/mod.rs b/crates/re_types/src/archetypes/mod.rs index d1e7d85ddc77..86281a0b475a 100644 --- a/crates/re_types/src/archetypes/mod.rs +++ b/crates/re_types/src/archetypes/mod.rs @@ -1,5 +1,7 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +mod fuzzy; mod points2d; +pub use self::fuzzy::AffixFuzzer1; pub use self::points2d::Points2D; diff --git a/crates/re_types/src/archetypes/points2d.rs b/crates/re_types/src/archetypes/points2d.rs index a68824add0c8..b3e03ac72e49 100644 --- a/crates/re_types/src/archetypes/points2d.rs +++ b/crates/re_types/src/archetypes/points2d.rs @@ -1,5 +1,13 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "A 2D point cloud with positions and optional colors, radii, labels, etc."] #[derive(Debug, Clone, PartialEq)] pub struct Points2D { diff --git a/crates/re_types/src/components/class_id.rs b/crates/re_types/src/components/class_id.rs index 24520b7e5040..64775ff5c49b 100644 --- a/crates/re_types/src/components/class_id.rs +++ b/crates/re_types/src/components/class_id.rs @@ -1,5 +1,13 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "A 16-bit ID representing a type of semantic class."] #[doc = ""] #[doc = "Used to look up a `crate::components::ClassDescription` within the `crate::components::AnnotationContext`."] @@ -7,11 +15,13 @@ pub struct ClassId(pub u16); impl crate::Component for ClassId { + #[inline] fn name() -> crate::ComponentName { crate::ComponentName::Borrowed("rerun.class_id") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/src/components/color.rs b/crates/re_types/src/components/color.rs index 5c7e6744b545..2acd13309b03 100644 --- a/crates/re_types/src/components/color.rs +++ b/crates/re_types/src/components/color.rs @@ -1,5 +1,13 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "An RGBA color tuple with unmultiplied/separate alpha, in sRGB gamma space with linear alpha."] #[derive( Debug, @@ -17,11 +25,13 @@ pub struct Color(pub u32); impl crate::Component for Color { + #[inline] fn name() -> crate::ComponentName { crate::ComponentName::Borrowed("rerun.colorrgba") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/src/components/draw_order.rs b/crates/re_types/src/components/draw_order.rs index b69822b74457..17e541b1fe2a 100644 --- a/crates/re_types/src/components/draw_order.rs +++ b/crates/re_types/src/components/draw_order.rs @@ -1,5 +1,13 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "Draw order used for the display order of 2D elements."] #[doc = ""] #[doc = "Higher values are drawn on top of lower values."] @@ -12,11 +20,13 @@ pub struct DrawOrder(pub f32); impl crate::Component for DrawOrder { + #[inline] fn name() -> crate::ComponentName { crate::ComponentName::Borrowed("rerun.draw_order") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/src/components/fuzzy.rs b/crates/re_types/src/components/fuzzy.rs new file mode 100644 index 000000000000..f977e38fefd5 --- /dev/null +++ b/crates/re_types/src/components/fuzzy.rs @@ -0,0 +1,637 @@ +// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. + +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer1 { + pub single_required: crate::datatypes::AffixFuzzer1, +} + +impl crate::Component for AffixFuzzer1 { + #[inline] + fn name() -> crate::ComponentName { + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer1") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.components.AffixFuzzer1".to_owned(), + Box::new(DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer1".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + )), + None, + ) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer2(pub crate::datatypes::AffixFuzzer1); + +impl crate::Component for AffixFuzzer2 { + #[inline] + fn name() -> crate::ComponentName { + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer2") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.components.AffixFuzzer2".to_owned(), + Box::new(DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer1".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + )), + None, + ) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer3 { + pub single_required: crate::datatypes::AffixFuzzer1, +} + +impl crate::Component for AffixFuzzer3 { + #[inline] + fn name() -> crate::ComponentName { + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer3") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.components.AffixFuzzer3".to_owned(), + Box::new(DataType::Struct(vec![Field { + name: "single_required".to_owned(), + data_type: DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer1".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + ), + is_nullable: false, + metadata: [].into(), + }])), + None, + ) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer4 { + pub single_optional: Option, +} + +impl crate::Component for AffixFuzzer4 { + #[inline] + fn name() -> crate::ComponentName { + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer4") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.components.AffixFuzzer4".to_owned(), + Box::new(DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer1".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + )), + None, + ) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer5(pub Option); + +impl crate::Component for AffixFuzzer5 { + #[inline] + fn name() -> crate::ComponentName { + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer5") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.components.AffixFuzzer5".to_owned(), + Box::new(DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer1".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + )), + None, + ) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer6 { + pub single_optional: Option, +} + +impl crate::Component for AffixFuzzer6 { + #[inline] + fn name() -> crate::ComponentName { + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer6") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.components.AffixFuzzer6".to_owned(), + Box::new(DataType::Struct(vec![Field { + name: "single_optional".to_owned(), + data_type: DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer1".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + ), + is_nullable: true, + metadata: [].into(), + }])), + None, + ) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer7 { + pub many_optional: Option>, + pub single_float_optional: Option, + pub single_string_required: String, + pub single_string_optional: Option, + pub many_floats_optional: Option>, + pub many_strings_required: Vec, + pub many_strings_optional: Option>, +} + +impl crate::Component for AffixFuzzer7 { + #[inline] + fn name() -> crate::ComponentName { + crate::ComponentName::Borrowed("rerun.testing.components.AffixFuzzer7") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.components.AffixFuzzer7".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "many_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer1".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + ), + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + ) + } +} diff --git a/crates/re_types/src/components/instance_key.rs b/crates/re_types/src/components/instance_key.rs index a1df2a09f429..b24fb1ee9ff8 100644 --- a/crates/re_types/src/components/instance_key.rs +++ b/crates/re_types/src/components/instance_key.rs @@ -1,15 +1,25 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "A unique numeric identifier for each individual instance within a batch."] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct InstanceKey(pub u64); impl crate::Component for InstanceKey { + #[inline] fn name() -> crate::ComponentName { crate::ComponentName::Borrowed("rerun.instance_key") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/src/components/keypoint_id.rs b/crates/re_types/src/components/keypoint_id.rs index b5646db5f0aa..413858197e7e 100644 --- a/crates/re_types/src/components/keypoint_id.rs +++ b/crates/re_types/src/components/keypoint_id.rs @@ -1,5 +1,13 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "A 16-bit ID representing a type of semantic keypoint within a class."] #[doc = ""] #[doc = "`KeypointId`s are only meaningful within the context of a `crate::components::ClassDescription`."] @@ -9,11 +17,13 @@ pub struct KeypointId(pub u16); impl crate::Component for KeypointId { + #[inline] fn name() -> crate::ComponentName { crate::ComponentName::Borrowed("rerun.keypoint_id") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/src/components/label.rs b/crates/re_types/src/components/label.rs index bfc8421e231f..44618ce60bf3 100644 --- a/crates/re_types/src/components/label.rs +++ b/crates/re_types/src/components/label.rs @@ -1,16 +1,26 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "A String label component."] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] pub struct Label(pub String); impl crate::Component for Label { + #[inline] fn name() -> crate::ComponentName { crate::ComponentName::Borrowed("rerun.label") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/src/components/mod.rs b/crates/re_types/src/components/mod.rs index 2a14150d0dcb..26a3b9cdeead 100644 --- a/crates/re_types/src/components/mod.rs +++ b/crates/re_types/src/components/mod.rs @@ -6,6 +6,7 @@ mod color; mod color_ext; mod draw_order; mod draw_order_ext; +mod fuzzy; mod instance_key; mod instance_key_ext; mod keypoint_id; @@ -20,6 +21,10 @@ mod radius_ext; pub use self::class_id::ClassId; pub use self::color::Color; pub use self::draw_order::DrawOrder; +pub use self::fuzzy::{ + AffixFuzzer1, AffixFuzzer2, AffixFuzzer3, AffixFuzzer4, AffixFuzzer5, AffixFuzzer6, + AffixFuzzer7, +}; pub use self::instance_key::InstanceKey; pub use self::keypoint_id::KeypointId; pub use self::label::Label; diff --git a/crates/re_types/src/components/point2d.rs b/crates/re_types/src/components/point2d.rs index 19df9df7dc73..d16ba5d48a2b 100644 --- a/crates/re_types/src/components/point2d.rs +++ b/crates/re_types/src/components/point2d.rs @@ -1,5 +1,13 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "A point in 2D space."] #[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd)] pub struct Point2D { @@ -8,11 +16,13 @@ pub struct Point2D { } impl crate::Component for Point2D { + #[inline] fn name() -> crate::ComponentName { crate::ComponentName::Borrowed("rerun.point2d") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/src/components/radius.rs b/crates/re_types/src/components/radius.rs index 2dec841b3dca..f3cfc0b4df81 100644 --- a/crates/re_types/src/components/radius.rs +++ b/crates/re_types/src/components/radius.rs @@ -1,15 +1,25 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "A Radius component."] #[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] pub struct Radius(pub f32); impl crate::Component for Radius { + #[inline] fn name() -> crate::ComponentName { crate::ComponentName::Borrowed("rerun.radius") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/src/datatypes/fuzzy.rs b/crates/re_types/src/datatypes/fuzzy.rs new file mode 100644 index 000000000000..7c2f544c29a5 --- /dev/null +++ b/crates/re_types/src/datatypes/fuzzy.rs @@ -0,0 +1,110 @@ +// NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. + +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer1 { + pub single_float_optional: Option, + pub single_string_required: String, + pub single_string_optional: Option, + pub many_floats_optional: Option>, + pub many_strings_required: Vec, + pub many_strings_optional: Option>, +} + +impl crate::Datatype for AffixFuzzer1 { + #[inline] + fn name() -> crate::DatatypeName { + crate::DatatypeName::Borrowed("rerun.testing.datatypes.AffixFuzzer1") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer1".to_owned(), + Box::new(DataType::Struct(vec![ + Field { + name: "single_float_optional".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "single_string_required".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "single_string_optional".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_floats_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Float32, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + Field { + name: "many_strings_required".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "many_strings_optional".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: true, + metadata: [].into(), + })), + is_nullable: true, + metadata: [].into(), + }, + ])), + None, + ) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct AffixFuzzer2(pub Option); + +impl crate::Datatype for AffixFuzzer2 { + #[inline] + fn name() -> crate::DatatypeName { + crate::DatatypeName::Borrowed("rerun.testing.datatypes.AffixFuzzer2") + } + + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] + fn to_arrow_datatype() -> arrow2::datatypes::DataType { + use ::arrow2::datatypes::*; + DataType::Extension( + "rerun.testing.datatypes.AffixFuzzer2".to_owned(), + Box::new(DataType::Float32), + None, + ) + } +} diff --git a/crates/re_types/src/datatypes/mod.rs b/crates/re_types/src/datatypes/mod.rs index b0247e086e63..5e5217d24e24 100644 --- a/crates/re_types/src/datatypes/mod.rs +++ b/crates/re_types/src/datatypes/mod.rs @@ -1,6 +1,8 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +mod fuzzy; mod vec2d; mod vec2d_ext; +pub use self::fuzzy::{AffixFuzzer1, AffixFuzzer2}; pub use self::vec2d::Vec2D; diff --git a/crates/re_types/src/datatypes/vec2d.rs b/crates/re_types/src/datatypes/vec2d.rs index efdeb64097cd..394013248c59 100644 --- a/crates/re_types/src/datatypes/vec2d.rs +++ b/crates/re_types/src/datatypes/vec2d.rs @@ -1,15 +1,25 @@ // NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. +#![allow(trivial_numeric_casts)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_cast)] + #[doc = "A vector in 2D space."] #[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd)] pub struct Vec2D(pub [f32; 2usize]); impl crate::Datatype for Vec2D { + #[inline] fn name() -> crate::DatatypeName { crate::DatatypeName::Borrowed("rerun.datatypes.Vec2D") } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; DataType::Extension( diff --git a/crates/re_types/tests/fuzzy.rs b/crates/re_types/tests/fuzzy.rs new file mode 100644 index 000000000000..40b9f97f3111 --- /dev/null +++ b/crates/re_types/tests/fuzzy.rs @@ -0,0 +1,128 @@ +#![allow(clippy::redundant_clone)] + +use re_types::archetypes::AffixFuzzer1; + +#[test] +fn roundtrip() { + let fuzzy1 = re_types::components::AffixFuzzer1 { + single_required: re_types::datatypes::AffixFuzzer1 { + single_float_optional: Some(1.0), + single_string_required: "a".into(), + single_string_optional: Some("a".into()), + many_floats_optional: Some(vec![1.0, 10.0, 100.0]), + many_strings_required: vec!["1".into(), "2".into()], + many_strings_optional: Some(vec!["10".into(), "20".into()]), + }, + }; + let fuzzy2 = re_types::components::AffixFuzzer2(re_types::datatypes::AffixFuzzer1 { + single_float_optional: None, + single_string_required: "b".into(), + single_string_optional: None, + many_floats_optional: Some(vec![2.0, 20.0, 200.0]), + many_strings_required: vec!["3".into(), "4".into()], + many_strings_optional: None, + }); + let fuzzy3 = re_types::components::AffixFuzzer3 { + single_required: re_types::datatypes::AffixFuzzer1 { + single_float_optional: Some(3.0), + single_string_required: "c".into(), + single_string_optional: Some("c".into()), + many_floats_optional: Some(vec![3.0, 30.0, 300.0]), + many_strings_required: vec!["5".into(), "6".into()], + many_strings_optional: Some(vec!["50".into(), "60".into()]), + }, + }; + let fuzzy4 = re_types::components::AffixFuzzer4 { + single_optional: Some(re_types::datatypes::AffixFuzzer1 { + single_float_optional: None, + single_string_required: "d".into(), + single_string_optional: None, + many_floats_optional: Some(vec![4.0, 40.0, 400.0]), + many_strings_required: vec!["7".into(), "8".into()], + many_strings_optional: None, + }), + }; + let fuzzy5 = re_types::components::AffixFuzzer5(None); + // let fuzzy5 = re_types::components::AffixFuzzer5(Some(re_types::datatypes::AffixFuzzer1 { + // single_float_optional: None, + // single_string_required: "d".into(), + // single_string_optional: None, + // many_floats_optional: Some(vec![4.0, 40.0, 400.0]), + // many_strings_required: vec!["7".into(), "8".into()], + // many_strings_optional: None, + // })); + let fuzzy6 = re_types::components::AffixFuzzer6 { + single_optional: None, + }; + // let fuzzy6 = re_types::components::AffixFuzzer6 { + // single_optional: Some(re_types::datatypes::AffixFuzzer1 { + // // single_float_optional: None, + // single_string_required: "d".into(), + // // single_string_optional: None, + // // many_floats_optional: Some(vec![4.0, 40.0, 400.0]), + // // many_strings_required: vec!["7".into(), "8".into()], + // // many_strings_optional: None, + // }), + // }; + let fuzzy7_1 = re_types::components::AffixFuzzer7 { + many_optional: None, + single_float_optional: None, + single_string_required: "b".into(), + single_string_optional: None, + many_floats_optional: Some(vec![1.0, 10.0]), + many_strings_required: vec!["1".into(), "10".into()], + many_strings_optional: None, + // TODO(cmc): this one is bugged. + // many_transparent_optionals: vec![], + }; + let fuzzy7_2 = re_types::components::AffixFuzzer7 { + many_optional: Some(vec![re_types::datatypes::AffixFuzzer1 { + single_float_optional: None, + single_string_required: "d".into(), + single_string_optional: None, + many_floats_optional: Some(vec![4.0, 40.0, 400.0]), + many_strings_required: vec!["7".into(), "8".into()], + many_strings_optional: None, + }]), + single_float_optional: Some(1.0), + single_string_required: "a".into(), + single_string_optional: Some("a".into()), + many_floats_optional: Some(vec![2.0, 20.0, 200.0]), + many_strings_required: vec!["20".into(), "200".into(), "2000".into()], + many_strings_optional: Some(vec![ + "30".into(), + "300".into(), + "3000".into(), + "30000".into(), + ]), + // TODO(cmc): this one is bugged. + // many_transparent_optionals: vec![], + }; + + let arch = AffixFuzzer1::new( + fuzzy1.clone(), + fuzzy2.clone(), + fuzzy3.clone(), + fuzzy4.clone(), + fuzzy5.clone(), + fuzzy6.clone(), + fuzzy7_1.clone(), + [fuzzy1.clone(), fuzzy1.clone(), fuzzy1.clone()], + [fuzzy2.clone(), fuzzy2.clone(), fuzzy2.clone()], + [fuzzy3.clone(), fuzzy3.clone(), fuzzy3.clone()], + [fuzzy4.clone(), fuzzy4.clone(), fuzzy4.clone()], + [fuzzy5.clone(), fuzzy5.clone(), fuzzy5.clone()], + [fuzzy6.clone(), fuzzy6.clone(), fuzzy6.clone()], + [fuzzy7_1.clone(), fuzzy7_2.clone()], + ) + .with_fuzz2001(fuzzy1.clone()) + .with_fuzz2003(fuzzy3.clone()) + .with_fuzz2005(fuzzy5.clone()) + .with_fuzz2007(fuzzy7_2.clone()) + .with_fuzz2102([fuzzy2.clone(), fuzzy2.clone(), fuzzy2.clone()]) + .with_fuzz2104([fuzzy4.clone(), fuzzy4.clone(), fuzzy4.clone()]) + .with_fuzz2106([fuzzy6.clone(), fuzzy6.clone(), fuzzy6.clone()]); + + eprintln!("arch = {arch:#?}"); + // TODO(cmc): roundtrips +} diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 6c0a1404893d..144570f4d58a 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -591,6 +591,7 @@ fn quote_import_clauses_from_field(field: &ObjectField) -> Option { // nasty lazy circular dependencies in weird edge cases... // In any case it will be normalized by `ruff` if it turns out to be unnecessary. fqname.map(|fqname| { + let fqname = fqname.replace(".testing", ""); let (from, class) = fqname.rsplit_once('.').unwrap_or(("", fqname.as_str())); if from.starts_with("rerun.datatypes") { "from .. import datatypes".to_owned() @@ -707,6 +708,7 @@ fn quote_type_from_element_type(typ: &ElementType) -> String { ElementType::Float16 | ElementType::Float32 | ElementType::Float64 => "float".to_owned(), ElementType::String => "str".to_owned(), ElementType::Object(fqname) => { + let fqname = fqname.replace(".testing", ""); let (from, class) = fqname.rsplit_once('.').unwrap_or(("", fqname.as_str())); if from.starts_with("rerun.datatypes") { format!("datatypes.{class}") @@ -727,7 +729,11 @@ fn quote_type_from_element_type(typ: &ElementType) -> String { fn quote_arrow_support_from_obj(arrow_registry: &ArrowRegistry, obj: &Object) -> String { let Object { - fqname, name, kind, .. + fqname, + name, + kind, + filepath, + .. } = obj; match kind { @@ -740,16 +746,9 @@ fn quote_arrow_support_from_obj(arrow_registry: &ArrowRegistry, obj: &Object) -> let many_aliases = format!("{name}ArrayLike"); let arrow = format!("{name}Type"); - use convert_case::{Boundary, Case, Casing}; - let pkg = name - .from_case(Case::Camel) - .without_boundaries(&[ - Boundary::DigitLower, - Boundary::DigitUpper, - Boundary::LowerDigit, - Boundary::UpperDigit, - ]) - .to_case(Case::Snake); + let mut filepath = PathBuf::from(filepath); + filepath.set_extension("py"); + let filename = filepath.file_stem().unwrap().to_string_lossy(); let legacy_fqname = obj .try_get_attr::(ATTR_RERUN_LEGACY_FQNAME) @@ -760,7 +759,7 @@ fn quote_arrow_support_from_obj(arrow_registry: &ArrowRegistry, obj: &Object) -> # --- Arrow support --- - from .{pkg}_ext import {many}Ext # noqa: E402 + from .{filename}_ext import {many}Ext # noqa: E402 class {arrow}(pa.ExtensionType): # type: ignore[misc] def __init__(self: type[pa.ExtensionType]) -> None: diff --git a/crates/re_types_builder/src/codegen/rust.rs b/crates/re_types_builder/src/codegen/rust.rs index 484f624d30c1..9cd62ca265e0 100644 --- a/crates/re_types_builder/src/codegen/rust.rs +++ b/crates/re_types_builder/src/codegen/rust.rs @@ -1,6 +1,7 @@ //! Implements the Rust codegen pass. use anyhow::Context as _; +use arrow2::datatypes::DataType; use proc_macro2::TokenStream; use quote::{format_ident, quote}; use std::{ @@ -17,6 +18,9 @@ use crate::{ ATTR_RUST_TUPLE_STRUCT, }; +// TODO(cmc): it'd be nice to be able to generate vanilla comments (as opposed to doc-comments) +// once again at some point (`TokenStream` strips them)... nothing too urgent though. + // --- pub struct RustCodeGenerator { @@ -42,6 +46,7 @@ impl CodeGenerator for RustCodeGenerator { filepaths.extend(create_files( datatypes_path, arrow_registry, + objects, &objects.ordered_objects(ObjectKind::Datatype.into()), )); @@ -52,6 +57,7 @@ impl CodeGenerator for RustCodeGenerator { filepaths.extend(create_files( components_path, arrow_registry, + objects, &objects.ordered_objects(ObjectKind::Component.into()), )); @@ -62,6 +68,7 @@ impl CodeGenerator for RustCodeGenerator { filepaths.extend(create_files( archetypes_path, arrow_registry, + objects, &objects.ordered_objects(ObjectKind::Archetype.into()), )); @@ -74,6 +81,7 @@ impl CodeGenerator for RustCodeGenerator { fn create_files( out_path: impl AsRef, arrow_registry: &ArrowRegistry, + objects: &Objects, objs: &[&Object], ) -> Vec { let out_path = out_path.as_ref(); @@ -83,9 +91,9 @@ fn create_files( let mut files = HashMap::>::new(); for obj in objs { let obj = if obj.is_struct() { - QuotedObject::from_struct(arrow_registry, obj) + QuotedObject::from_struct(arrow_registry, objects, obj) } else { - QuotedObject::from_union(arrow_registry, obj) + QuotedObject::from_union(arrow_registry, objects, obj) }; let filepath = out_path.join(obj.filepath.file_name().unwrap()); @@ -111,6 +119,13 @@ fn create_files( let mut code = String::new(); code.push_text(format!("// {AUTOGEN_WARNING}"), 2, 0); + code.push_text("#![allow(trivial_numeric_casts)]", 2, 0); + code.push_text("#![allow(unused_parens)]", 2, 0); + code.push_text("#![allow(clippy::clone_on_copy)]", 2, 0); + code.push_text("#![allow(clippy::map_flatten)]", 2, 0); + code.push_text("#![allow(clippy::needless_question_mark)]", 2, 0); + code.push_text("#![allow(clippy::too_many_arguments)]", 2, 0); + code.push_text("#![allow(clippy::unnecessary_cast)]", 2, 0); for obj in objs { let tokens_str = obj.tokens.to_string(); @@ -176,7 +191,7 @@ struct QuotedObject { } impl QuotedObject { - fn from_struct(arrow_registry: &ArrowRegistry, obj: &Object) -> Self { + fn from_struct(arrow_registry: &ArrowRegistry, objects: &Objects, obj: &Object) -> Self { assert!(obj.is_struct()); let Object { @@ -209,7 +224,7 @@ impl QuotedObject { quote! { pub struct #name { #(#quoted_fields,)* } } }; - let quoted_trait_impls = quote_trait_impls_from_obj(arrow_registry, obj); + let quoted_trait_impls = quote_trait_impls_from_obj(arrow_registry, objects, obj); let quoted_builder = quote_builder_from_obj(obj); @@ -235,7 +250,7 @@ impl QuotedObject { } } - fn from_union(arrow_registry: &ArrowRegistry, obj: &Object) -> Self { + fn from_union(arrow_registry: &ArrowRegistry, objects: &Objects, obj: &Object) -> Self { assert!(!obj.is_struct()); let Object { @@ -282,7 +297,7 @@ impl QuotedObject { } }); - let quoted_trait_impls = quote_trait_impls_from_obj(arrow_registry, obj); + let quoted_trait_impls = quote_trait_impls_from_obj(arrow_registry, objects, obj); let tokens = quote! { #quoted_doc @@ -453,7 +468,11 @@ fn quote_meta_clause_from_obj(obj: &Object, attr: &str, clause: &str) -> TokenSt quote!(#quoted) } -fn quote_trait_impls_from_obj(arrow_registry: &ArrowRegistry, obj: &Object) -> TokenStream { +fn quote_trait_impls_from_obj( + arrow_registry: &ArrowRegistry, + _objects: &Objects, + obj: &Object, +) -> TokenStream { let Object { filepath: _, fqname, @@ -487,11 +506,13 @@ fn quote_trait_impls_from_obj(arrow_registry: &ArrowRegistry, obj: &Object) -> T quote! { impl crate::#kind for #name { + #[inline] fn name() -> crate::#kind_name { crate::#kind_name::Borrowed(#legacy_fqname) } - #[allow(clippy::wildcard_imports)] + #[allow(unused_imports, clippy::wildcard_imports)] + #[inline] fn to_arrow_datatype() -> arrow2::datatypes::DataType { use ::arrow2::datatypes::*; #datatype @@ -662,7 +683,7 @@ struct ArrowDataTypeTokenizer<'a>(&'a ::arrow2::datatypes::DataType); impl quote::ToTokens for ArrowDataTypeTokenizer<'_> { fn to_tokens(&self, tokens: &mut TokenStream) { - use arrow2::datatypes::{DataType, UnionMode}; + use arrow2::datatypes::UnionMode; match self.0 { DataType::Null => quote!(DataType::Null), DataType::Boolean => quote!(DataType::Boolean), @@ -681,10 +702,17 @@ impl quote::ToTokens for ArrowDataTypeTokenizer<'_> { DataType::LargeBinary => quote!(DataType::LargeBinary), DataType::Utf8 => quote!(DataType::Utf8), DataType::LargeUtf8 => quote!(DataType::LargeUtf8), + + DataType::List(field) => { + let field = ArrowFieldTokenizer(field); + quote!(DataType::List(Box::new(#field))) + } + DataType::FixedSizeList(field, length) => { let field = ArrowFieldTokenizer(field); quote!(DataType::FixedSizeList(Box::new(#field), #length)) } + DataType::Union(fields, _, mode) => { let fields = fields.iter().map(ArrowFieldTokenizer); let mode = match mode { @@ -693,15 +721,18 @@ impl quote::ToTokens for ArrowDataTypeTokenizer<'_> { }; quote!(DataType::Union(#(#fields,)*, None, #mode)) } + DataType::Struct(fields) => { let fields = fields.iter().map(ArrowFieldTokenizer); quote!(DataType::Struct(vec![ #(#fields,)* ])) } + DataType::Extension(name, datatype, metadata) => { let datatype = ArrowDataTypeTokenizer(datatype); let metadata = OptionTokenizer(metadata.as_ref()); quote!(DataType::Extension(#name.to_owned(), Box::new(#datatype), #metadata)) } + _ => unimplemented!("{:#?}", self.0), // NOLINT } .to_tokens(tokens); @@ -759,7 +790,11 @@ impl quote::ToTokens for StrStrMapTokenizer<'_> { } fn quote_fqname_as_type_path(fqname: impl AsRef) -> TokenStream { - let fqname = fqname.as_ref().replace('.', "::").replace("rerun", "crate"); + let fqname = fqname + .as_ref() + .replace(".testing", "") + .replace('.', "::") + .replace("rerun", "crate"); let expr: syn::TypePath = syn::parse_str(&fqname).unwrap(); quote!(#expr) } diff --git a/crates/re_types_builder/src/lib.rs b/crates/re_types_builder/src/lib.rs index 9da75e8df863..73bb5eaf039b 100644 --- a/crates/re_types_builder/src/lib.rs +++ b/crates/re_types_builder/src/lib.rs @@ -60,6 +60,41 @@ //! brings very little value. //! //! Make sure to test the behavior of its output though: `re_types`! +//! +//! +//! ### Understanding the subtleties of affixes +//! +//! So-called "affixes" are effects applied to objects defined with the Rerun IDL and that affect +//! the way these objects behave and interoperate with each other (so, yes, monads. shhh.). +//! +//! There are 3 distinct and very common affixes used when working with Rerun's IDL: transparency, +//! nullability and plurality. +//! +//! Broadly, we can describe these affixes as follows: +//! - Transparency allows for bypassing a single layer of typing (e.g. to "extract" a field out of +//! a struct). +//! - Nullability specifies whether a piece of data is allowed to be left unspecified at runtime. +//! - Plurality specifies whether a piece of data is actually a collection of that same type. +//! +//! We say "broadly" here because the way these affixes ultimately affect objects in practice will +//! actually depend on the kind of object that they are applied to, of which there are 3: archetypes, +//! components and datatypes. +//! +//! Not only that, but objects defined in Rerun's IDL are materialized into 3 distinct environments: +//! IDL definitions, Arrow datatypes and native code (e.g. Rust & Python). +//! +//! These environment have vastly different characteristics, quirks, pitfalls and limitations, +//! which once again lead to these affixes having different, sometimes surprising behavior +//! depending on the environment we're interested in. +//! Also keep in mind that Flatbuffers and native code are generally designed around arrays of +//! structures, while Arrow is all about structures of arrays! +//! +//! All in all, these interactions between affixes, object kinds and environments lead to a +//! combinatorial explosion of edge cases that can be very confusing when it comes to (de)serialization +//! code, and even API design. +//! +//! When in doubt, check out the `rerun.testing.archetypes.AffixFuzzer` IDL definitions, generated code and +//! test suites for definitive answers. // TODO(#2365): support for external IDL definitions diff --git a/crates/re_types_builder/src/objects.rs b/crates/re_types_builder/src/objects.rs index 069a27330e59..50559609100b 100644 --- a/crates/re_types_builder/src/objects.rs +++ b/crates/re_types_builder/src/objects.rs @@ -123,7 +123,7 @@ pub enum ObjectKind { impl ObjectKind { // TODO(#2364): use an attr instead of the path pub fn from_pkg_name(pkg_name: impl AsRef) -> Self { - let pkg_name = pkg_name.as_ref(); + let pkg_name = pkg_name.as_ref().replace(".testing", ""); if pkg_name.starts_with("rerun.datatypes") { ObjectKind::Datatype } else if pkg_name.starts_with("rerun.components") { diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/__init__.py b/rerun_py/rerun_sdk/rerun/_rerun2/__init__.py index 119eedd4d003..436e54dd125e 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/__init__.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/__init__.py @@ -2,6 +2,6 @@ from __future__ import annotations -__all__ = ["Points2D"] +__all__ = ["AffixFuzzer1", "Points2D"] -from .archetypes import Points2D +from .archetypes import AffixFuzzer1, Points2D diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/__init__.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/__init__.py index 8da47e061354..b63e459e6d55 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations -__all__ = ["Points2D"] +__all__ = ["AffixFuzzer1", "Points2D"] +from .fuzzy import AffixFuzzer1 from .points2d import Points2D diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/fuzzy.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/fuzzy.py new file mode 100644 index 000000000000..fcff0b4adb97 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/fuzzy.py @@ -0,0 +1,128 @@ +# NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. + +from __future__ import annotations + +from dataclasses import dataclass + +__all__ = ["AffixFuzzer1"] + +from .. import components + +## --- AffixFuzzer1 --- ## + + +@dataclass +class AffixFuzzer1: + fuzz1001: components.AffixFuzzer1Array + fuzz1002: components.AffixFuzzer2Array + fuzz1003: components.AffixFuzzer3Array + fuzz1004: components.AffixFuzzer4Array + fuzz1005: components.AffixFuzzer5Array + fuzz1006: components.AffixFuzzer6Array + fuzz1007: components.AffixFuzzer7Array + fuzz1101: components.AffixFuzzer1Array + fuzz1102: components.AffixFuzzer2Array + fuzz1103: components.AffixFuzzer3Array + fuzz1104: components.AffixFuzzer4Array + fuzz1105: components.AffixFuzzer5Array + fuzz1106: components.AffixFuzzer6Array + fuzz1107: components.AffixFuzzer7Array + fuzz2001: components.AffixFuzzer1Array | None = None + fuzz2002: components.AffixFuzzer2Array | None = None + fuzz2003: components.AffixFuzzer3Array | None = None + fuzz2004: components.AffixFuzzer4Array | None = None + fuzz2005: components.AffixFuzzer5Array | None = None + fuzz2006: components.AffixFuzzer6Array | None = None + fuzz2007: components.AffixFuzzer7Array | None = None + fuzz2101: components.AffixFuzzer1Array | None = None + fuzz2102: components.AffixFuzzer2Array | None = None + fuzz2103: components.AffixFuzzer3Array | None = None + fuzz2104: components.AffixFuzzer4Array | None = None + fuzz2105: components.AffixFuzzer5Array | None = None + fuzz2106: components.AffixFuzzer6Array | None = None + fuzz2107: components.AffixFuzzer7Array | None = None + + def __str__(self) -> str: + s = f"rr.{type(self).__name__}(\n" + + from dataclasses import fields + + for field in fields(self): + data = getattr(self, field.name) + datatype = getattr(data, "type", None) + if datatype: + name = datatype.extension_name + typ = datatype.storage_type + s += f" {name}<{typ}>(\n {data.to_pylist()}\n )\n" + + s += ")" + + return s + + def __repr__(self) -> str: + return str(self) + + def __init__( + self, + fuzz1001: components.AffixFuzzer1Like, + fuzz1002: components.AffixFuzzer2Like, + fuzz1003: components.AffixFuzzer3Like, + fuzz1004: components.AffixFuzzer4Like, + fuzz1005: components.AffixFuzzer5Like, + fuzz1006: components.AffixFuzzer6Like, + fuzz1007: components.AffixFuzzer7Like, + fuzz1101: components.AffixFuzzer1ArrayLike, + fuzz1102: components.AffixFuzzer2ArrayLike, + fuzz1103: components.AffixFuzzer3ArrayLike, + fuzz1104: components.AffixFuzzer4ArrayLike, + fuzz1105: components.AffixFuzzer5ArrayLike, + fuzz1106: components.AffixFuzzer6ArrayLike, + fuzz1107: components.AffixFuzzer7ArrayLike, + *, + fuzz2001: components.AffixFuzzer1Like | None = None, + fuzz2002: components.AffixFuzzer2Like | None = None, + fuzz2003: components.AffixFuzzer3Like | None = None, + fuzz2004: components.AffixFuzzer4Like | None = None, + fuzz2005: components.AffixFuzzer5Like | None = None, + fuzz2006: components.AffixFuzzer6Like | None = None, + fuzz2007: components.AffixFuzzer7Like | None = None, + fuzz2101: components.AffixFuzzer1ArrayLike | None = None, + fuzz2102: components.AffixFuzzer2ArrayLike | None = None, + fuzz2103: components.AffixFuzzer3ArrayLike | None = None, + fuzz2104: components.AffixFuzzer4ArrayLike | None = None, + fuzz2105: components.AffixFuzzer5ArrayLike | None = None, + fuzz2106: components.AffixFuzzer6ArrayLike | None = None, + fuzz2107: components.AffixFuzzer7ArrayLike | None = None, + ) -> None: + # Required components + self.fuzz1001 = components.AffixFuzzer1Array.from_similar(fuzz1001) + self.fuzz1002 = components.AffixFuzzer2Array.from_similar(fuzz1002) + self.fuzz1003 = components.AffixFuzzer3Array.from_similar(fuzz1003) + self.fuzz1004 = components.AffixFuzzer4Array.from_similar(fuzz1004) + self.fuzz1005 = components.AffixFuzzer5Array.from_similar(fuzz1005) + self.fuzz1006 = components.AffixFuzzer6Array.from_similar(fuzz1006) + self.fuzz1007 = components.AffixFuzzer7Array.from_similar(fuzz1007) + self.fuzz1101 = components.AffixFuzzer1Array.from_similar(fuzz1101) + self.fuzz1102 = components.AffixFuzzer2Array.from_similar(fuzz1102) + self.fuzz1103 = components.AffixFuzzer3Array.from_similar(fuzz1103) + self.fuzz1104 = components.AffixFuzzer4Array.from_similar(fuzz1104) + self.fuzz1105 = components.AffixFuzzer5Array.from_similar(fuzz1105) + self.fuzz1106 = components.AffixFuzzer6Array.from_similar(fuzz1106) + self.fuzz1107 = components.AffixFuzzer7Array.from_similar(fuzz1107) + + # Optional components + + self.fuzz2001 = components.AffixFuzzer1Array.from_similar(fuzz2001) + self.fuzz2002 = components.AffixFuzzer2Array.from_similar(fuzz2002) + self.fuzz2003 = components.AffixFuzzer3Array.from_similar(fuzz2003) + self.fuzz2004 = components.AffixFuzzer4Array.from_similar(fuzz2004) + self.fuzz2005 = components.AffixFuzzer5Array.from_similar(fuzz2005) + self.fuzz2006 = components.AffixFuzzer6Array.from_similar(fuzz2006) + self.fuzz2007 = components.AffixFuzzer7Array.from_similar(fuzz2007) + self.fuzz2101 = components.AffixFuzzer1Array.from_similar(fuzz2101) + self.fuzz2102 = components.AffixFuzzer2Array.from_similar(fuzz2102) + self.fuzz2103 = components.AffixFuzzer3Array.from_similar(fuzz2103) + self.fuzz2104 = components.AffixFuzzer4Array.from_similar(fuzz2104) + self.fuzz2105 = components.AffixFuzzer5Array.from_similar(fuzz2105) + self.fuzz2106 = components.AffixFuzzer6Array.from_similar(fuzz2106) + self.fuzz2107 = components.AffixFuzzer7Array.from_similar(fuzz2107) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py index 4df720bde45f..39cab6189458 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py @@ -3,6 +3,41 @@ from __future__ import annotations __all__ = [ + "AffixFuzzer1", + "AffixFuzzer1Array", + "AffixFuzzer1ArrayLike", + "AffixFuzzer1Like", + "AffixFuzzer1Type", + "AffixFuzzer2", + "AffixFuzzer2Array", + "AffixFuzzer2ArrayLike", + "AffixFuzzer2Like", + "AffixFuzzer2Type", + "AffixFuzzer3", + "AffixFuzzer3Array", + "AffixFuzzer3ArrayLike", + "AffixFuzzer3Like", + "AffixFuzzer3Type", + "AffixFuzzer4", + "AffixFuzzer4Array", + "AffixFuzzer4ArrayLike", + "AffixFuzzer4Like", + "AffixFuzzer4Type", + "AffixFuzzer5", + "AffixFuzzer5Array", + "AffixFuzzer5ArrayLike", + "AffixFuzzer5Like", + "AffixFuzzer5Type", + "AffixFuzzer6", + "AffixFuzzer6Array", + "AffixFuzzer6ArrayLike", + "AffixFuzzer6Like", + "AffixFuzzer6Type", + "AffixFuzzer7", + "AffixFuzzer7Array", + "AffixFuzzer7ArrayLike", + "AffixFuzzer7Like", + "AffixFuzzer7Type", "ClassId", "ClassIdArray", "ClassIdArrayLike", @@ -48,6 +83,43 @@ from .class_id import ClassId, ClassIdArray, ClassIdArrayLike, ClassIdLike, ClassIdType from .color import Color, ColorArray, ColorArrayLike, ColorLike, ColorType from .draw_order import DrawOrder, DrawOrderArray, DrawOrderArrayLike, DrawOrderLike, DrawOrderType +from .fuzzy import ( + AffixFuzzer1, + AffixFuzzer1Array, + AffixFuzzer1ArrayLike, + AffixFuzzer1Like, + AffixFuzzer1Type, + AffixFuzzer2, + AffixFuzzer2Array, + AffixFuzzer2ArrayLike, + AffixFuzzer2Like, + AffixFuzzer2Type, + AffixFuzzer3, + AffixFuzzer3Array, + AffixFuzzer3ArrayLike, + AffixFuzzer3Like, + AffixFuzzer3Type, + AffixFuzzer4, + AffixFuzzer4Array, + AffixFuzzer4ArrayLike, + AffixFuzzer4Like, + AffixFuzzer4Type, + AffixFuzzer5, + AffixFuzzer5Array, + AffixFuzzer5ArrayLike, + AffixFuzzer5Like, + AffixFuzzer5Type, + AffixFuzzer6, + AffixFuzzer6Array, + AffixFuzzer6ArrayLike, + AffixFuzzer6Like, + AffixFuzzer6Type, + AffixFuzzer7, + AffixFuzzer7Array, + AffixFuzzer7ArrayLike, + AffixFuzzer7Like, + AffixFuzzer7Type, +) from .instance_key import InstanceKey, InstanceKeyArray, InstanceKeyArrayLike, InstanceKeyLike, InstanceKeyType from .keypoint_id import KeypointId, KeypointIdArray, KeypointIdArrayLike, KeypointIdLike, KeypointIdType from .label import Label, LabelArray, LabelArrayLike, LabelLike, LabelType diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/fuzzy.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/fuzzy.py new file mode 100644 index 000000000000..905feacc6a6e --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/fuzzy.py @@ -0,0 +1,625 @@ +# NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. + +from __future__ import annotations + +from dataclasses import dataclass +from typing import Any, Sequence, Union + +import numpy.typing as npt +import pyarrow as pa + +__all__ = [ + "AffixFuzzer1", + "AffixFuzzer1Array", + "AffixFuzzer1ArrayLike", + "AffixFuzzer1Like", + "AffixFuzzer1Type", + "AffixFuzzer2", + "AffixFuzzer2Array", + "AffixFuzzer2ArrayLike", + "AffixFuzzer2Like", + "AffixFuzzer2Type", + "AffixFuzzer3", + "AffixFuzzer3Array", + "AffixFuzzer3ArrayLike", + "AffixFuzzer3Like", + "AffixFuzzer3Type", + "AffixFuzzer4", + "AffixFuzzer4Array", + "AffixFuzzer4ArrayLike", + "AffixFuzzer4Like", + "AffixFuzzer4Type", + "AffixFuzzer5", + "AffixFuzzer5Array", + "AffixFuzzer5ArrayLike", + "AffixFuzzer5Like", + "AffixFuzzer5Type", + "AffixFuzzer6", + "AffixFuzzer6Array", + "AffixFuzzer6ArrayLike", + "AffixFuzzer6Like", + "AffixFuzzer6Type", + "AffixFuzzer7", + "AffixFuzzer7Array", + "AffixFuzzer7ArrayLike", + "AffixFuzzer7Like", + "AffixFuzzer7Type", +] + +from .. import datatypes + +## --- AffixFuzzer1 --- ## + + +@dataclass +class AffixFuzzer1: + single_required: datatypes.AffixFuzzer1 + + +AffixFuzzer1Like = AffixFuzzer1 +AffixFuzzer1ArrayLike = Union[ + AffixFuzzer1Like, + Sequence[AffixFuzzer1Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer1ArrayExt # noqa: E402 + + +class AffixFuzzer1Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field("many_floats_optional", pa.list_(pa.field("item", pa.float32(), True, {})), True, {}), + pa.field("many_strings_required", pa.list_(pa.field("item", pa.utf8(), False, {})), False, {}), + pa.field("many_strings_optional", pa.list_(pa.field("item", pa.utf8(), True, {})), True, {}), + ] + ), + "rerun.testing.components.AffixFuzzer1", + ) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer1Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer1Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer1Type()) + + +class AffixFuzzer1Array(pa.ExtensionArray, AffixFuzzer1ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer1ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer1Type().wrap_array(pa.array([], type=AffixFuzzer1Type().storage_type)) + else: + return AffixFuzzer1ArrayExt._from_similar( + data, + mono=AffixFuzzer1, + mono_aliases=AffixFuzzer1Like, + many=AffixFuzzer1Array, + many_aliases=AffixFuzzer1ArrayLike, + arrow=AffixFuzzer1Type, + ) + + +## --- AffixFuzzer2 --- ## + + +@dataclass +class AffixFuzzer2: + single_required: datatypes.AffixFuzzer1 + + +AffixFuzzer2Like = AffixFuzzer2 +AffixFuzzer2ArrayLike = Union[ + AffixFuzzer2Like, + Sequence[AffixFuzzer2Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer2ArrayExt # noqa: E402 + + +class AffixFuzzer2Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field("many_floats_optional", pa.list_(pa.field("item", pa.float32(), True, {})), True, {}), + pa.field("many_strings_required", pa.list_(pa.field("item", pa.utf8(), False, {})), False, {}), + pa.field("many_strings_optional", pa.list_(pa.field("item", pa.utf8(), True, {})), True, {}), + ] + ), + "rerun.testing.components.AffixFuzzer2", + ) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer2Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer2Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer2Type()) + + +class AffixFuzzer2Array(pa.ExtensionArray, AffixFuzzer2ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer2ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer2Type().wrap_array(pa.array([], type=AffixFuzzer2Type().storage_type)) + else: + return AffixFuzzer2ArrayExt._from_similar( + data, + mono=AffixFuzzer2, + mono_aliases=AffixFuzzer2Like, + many=AffixFuzzer2Array, + many_aliases=AffixFuzzer2ArrayLike, + arrow=AffixFuzzer2Type, + ) + + +## --- AffixFuzzer3 --- ## + + +@dataclass +class AffixFuzzer3: + single_required: datatypes.AffixFuzzer1 + + +AffixFuzzer3Like = AffixFuzzer3 +AffixFuzzer3ArrayLike = Union[ + AffixFuzzer3Like, + Sequence[AffixFuzzer3Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer3ArrayExt # noqa: E402 + + +class AffixFuzzer3Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field( + "single_required", + pa.struct( + [ + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field( + "many_floats_optional", pa.list_(pa.field("item", pa.float32(), True, {})), True, {} + ), + pa.field( + "many_strings_required", pa.list_(pa.field("item", pa.utf8(), False, {})), False, {} + ), + pa.field( + "many_strings_optional", pa.list_(pa.field("item", pa.utf8(), True, {})), True, {} + ), + ] + ), + False, + {}, + ) + ] + ), + "rerun.testing.components.AffixFuzzer3", + ) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer3Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer3Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer3Type()) + + +class AffixFuzzer3Array(pa.ExtensionArray, AffixFuzzer3ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer3ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer3Type().wrap_array(pa.array([], type=AffixFuzzer3Type().storage_type)) + else: + return AffixFuzzer3ArrayExt._from_similar( + data, + mono=AffixFuzzer3, + mono_aliases=AffixFuzzer3Like, + many=AffixFuzzer3Array, + many_aliases=AffixFuzzer3ArrayLike, + arrow=AffixFuzzer3Type, + ) + + +## --- AffixFuzzer4 --- ## + + +@dataclass +class AffixFuzzer4: + single_optional: datatypes.AffixFuzzer1 | None = None + + +AffixFuzzer4Like = AffixFuzzer4 +AffixFuzzer4ArrayLike = Union[ + AffixFuzzer4Like, + Sequence[AffixFuzzer4Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer4ArrayExt # noqa: E402 + + +class AffixFuzzer4Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field("many_floats_optional", pa.list_(pa.field("item", pa.float32(), True, {})), True, {}), + pa.field("many_strings_required", pa.list_(pa.field("item", pa.utf8(), False, {})), False, {}), + pa.field("many_strings_optional", pa.list_(pa.field("item", pa.utf8(), True, {})), True, {}), + ] + ), + "rerun.testing.components.AffixFuzzer4", + ) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer4Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer4Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer4Type()) + + +class AffixFuzzer4Array(pa.ExtensionArray, AffixFuzzer4ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer4ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer4Type().wrap_array(pa.array([], type=AffixFuzzer4Type().storage_type)) + else: + return AffixFuzzer4ArrayExt._from_similar( + data, + mono=AffixFuzzer4, + mono_aliases=AffixFuzzer4Like, + many=AffixFuzzer4Array, + many_aliases=AffixFuzzer4ArrayLike, + arrow=AffixFuzzer4Type, + ) + + +## --- AffixFuzzer5 --- ## + + +@dataclass +class AffixFuzzer5: + single_optional: datatypes.AffixFuzzer1 | None = None + + +AffixFuzzer5Like = AffixFuzzer5 +AffixFuzzer5ArrayLike = Union[ + AffixFuzzer5Like, + Sequence[AffixFuzzer5Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer5ArrayExt # noqa: E402 + + +class AffixFuzzer5Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field("many_floats_optional", pa.list_(pa.field("item", pa.float32(), True, {})), True, {}), + pa.field("many_strings_required", pa.list_(pa.field("item", pa.utf8(), False, {})), False, {}), + pa.field("many_strings_optional", pa.list_(pa.field("item", pa.utf8(), True, {})), True, {}), + ] + ), + "rerun.testing.components.AffixFuzzer5", + ) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer5Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer5Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer5Type()) + + +class AffixFuzzer5Array(pa.ExtensionArray, AffixFuzzer5ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer5ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer5Type().wrap_array(pa.array([], type=AffixFuzzer5Type().storage_type)) + else: + return AffixFuzzer5ArrayExt._from_similar( + data, + mono=AffixFuzzer5, + mono_aliases=AffixFuzzer5Like, + many=AffixFuzzer5Array, + many_aliases=AffixFuzzer5ArrayLike, + arrow=AffixFuzzer5Type, + ) + + +## --- AffixFuzzer6 --- ## + + +@dataclass +class AffixFuzzer6: + single_optional: datatypes.AffixFuzzer1 | None = None + + +AffixFuzzer6Like = AffixFuzzer6 +AffixFuzzer6ArrayLike = Union[ + AffixFuzzer6Like, + Sequence[AffixFuzzer6Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer6ArrayExt # noqa: E402 + + +class AffixFuzzer6Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field( + "single_optional", + pa.struct( + [ + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field( + "many_floats_optional", pa.list_(pa.field("item", pa.float32(), True, {})), True, {} + ), + pa.field( + "many_strings_required", pa.list_(pa.field("item", pa.utf8(), False, {})), False, {} + ), + pa.field( + "many_strings_optional", pa.list_(pa.field("item", pa.utf8(), True, {})), True, {} + ), + ] + ), + True, + {}, + ) + ] + ), + "rerun.testing.components.AffixFuzzer6", + ) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer6Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer6Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer6Type()) + + +class AffixFuzzer6Array(pa.ExtensionArray, AffixFuzzer6ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer6ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer6Type().wrap_array(pa.array([], type=AffixFuzzer6Type().storage_type)) + else: + return AffixFuzzer6ArrayExt._from_similar( + data, + mono=AffixFuzzer6, + mono_aliases=AffixFuzzer6Like, + many=AffixFuzzer6Array, + many_aliases=AffixFuzzer6ArrayLike, + arrow=AffixFuzzer6Type, + ) + + +## --- AffixFuzzer7 --- ## + + +@dataclass +class AffixFuzzer7: + single_string_required: str + many_strings_required: npt.ArrayLike + many_optional: list[datatypes.AffixFuzzer1] | None = None + single_float_optional: float | None = None + single_string_optional: str | None = None + many_floats_optional: npt.ArrayLike | None = None + many_strings_optional: npt.ArrayLike | None = None + + +AffixFuzzer7Like = AffixFuzzer7 +AffixFuzzer7ArrayLike = Union[ + AffixFuzzer7Like, + Sequence[AffixFuzzer7Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer7ArrayExt # noqa: E402 + + +class AffixFuzzer7Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field( + "many_optional", + pa.list_( + pa.field( + "item", + pa.struct( + [ + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field( + "many_floats_optional", + pa.list_(pa.field("item", pa.float32(), True, {})), + True, + {}, + ), + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), False, {})), + False, + {}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), True, {})), + True, + {}, + ), + ] + ), + True, + {}, + ) + ), + True, + {}, + ), + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field("many_floats_optional", pa.list_(pa.field("item", pa.float32(), True, {})), True, {}), + pa.field("many_strings_required", pa.list_(pa.field("item", pa.utf8(), False, {})), False, {}), + pa.field("many_strings_optional", pa.list_(pa.field("item", pa.utf8(), True, {})), True, {}), + ] + ), + "rerun.testing.components.AffixFuzzer7", + ) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer7Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer7Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer7Type()) + + +class AffixFuzzer7Array(pa.ExtensionArray, AffixFuzzer7ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer7ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer7Type().wrap_array(pa.array([], type=AffixFuzzer7Type().storage_type)) + else: + return AffixFuzzer7ArrayExt._from_similar( + data, + mono=AffixFuzzer7, + mono_aliases=AffixFuzzer7Like, + many=AffixFuzzer7Array, + many_aliases=AffixFuzzer7ArrayLike, + arrow=AffixFuzzer7Type, + ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/fuzzy_ext.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/fuzzy_ext.py new file mode 100644 index 000000000000..73c1b3c61549 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/fuzzy_ext.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +__all__ = [ + "AffixFuzzer1ArrayExt", + "AffixFuzzer2ArrayExt", + "AffixFuzzer3ArrayExt", + "AffixFuzzer4ArrayExt", + "AffixFuzzer5ArrayExt", + "AffixFuzzer6ArrayExt", + "AffixFuzzer7ArrayExt", +] + +from typing import Any + +import pyarrow as pa + + +class AffixFuzzer1ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError() + + +class AffixFuzzer2ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError() + + +class AffixFuzzer3ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError() + + +class AffixFuzzer4ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError() + + +class AffixFuzzer5ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError() + + +class AffixFuzzer6ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError() + + +class AffixFuzzer7ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError() diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/__init__.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/__init__.py index ae53900b9e59..9519be379256 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/__init__.py @@ -2,6 +2,34 @@ from __future__ import annotations -__all__ = ["Vec2D", "Vec2DArray", "Vec2DArrayLike", "Vec2DLike", "Vec2DType"] +__all__ = [ + "AffixFuzzer1", + "AffixFuzzer1Array", + "AffixFuzzer1ArrayLike", + "AffixFuzzer1Like", + "AffixFuzzer1Type", + "AffixFuzzer2", + "AffixFuzzer2Array", + "AffixFuzzer2ArrayLike", + "AffixFuzzer2Like", + "AffixFuzzer2Type", + "Vec2D", + "Vec2DArray", + "Vec2DArrayLike", + "Vec2DLike", + "Vec2DType", +] +from .fuzzy import ( + AffixFuzzer1, + AffixFuzzer1Array, + AffixFuzzer1ArrayLike, + AffixFuzzer1Like, + AffixFuzzer1Type, + AffixFuzzer2, + AffixFuzzer2Array, + AffixFuzzer2ArrayLike, + AffixFuzzer2Like, + AffixFuzzer2Type, +) from .vec2d import Vec2D, Vec2DArray, Vec2DArrayLike, Vec2DLike, Vec2DType diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/fuzzy.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/fuzzy.py new file mode 100644 index 000000000000..76d2ee4da208 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/fuzzy.py @@ -0,0 +1,162 @@ +# NOTE: This file was autogenerated by re_types_builder; DO NOT EDIT. + +from __future__ import annotations + +from dataclasses import dataclass +from typing import Any, Sequence, Union + +import numpy as np +import numpy.typing as npt +import pyarrow as pa + +__all__ = [ + "AffixFuzzer1", + "AffixFuzzer1Array", + "AffixFuzzer1ArrayLike", + "AffixFuzzer1Like", + "AffixFuzzer1Type", + "AffixFuzzer2", + "AffixFuzzer2Array", + "AffixFuzzer2ArrayLike", + "AffixFuzzer2Like", + "AffixFuzzer2Type", +] + + +## --- AffixFuzzer1 --- ## + + +@dataclass +class AffixFuzzer1: + single_string_required: str + many_strings_required: npt.ArrayLike + single_float_optional: float | None = None + single_string_optional: str | None = None + many_floats_optional: npt.ArrayLike | None = None + many_strings_optional: npt.ArrayLike | None = None + + +AffixFuzzer1Like = AffixFuzzer1 +AffixFuzzer1ArrayLike = Union[ + AffixFuzzer1Like, + Sequence[AffixFuzzer1Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer1ArrayExt # noqa: E402 + + +class AffixFuzzer1Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field("single_float_optional", pa.float32(), True, {}), + pa.field("single_string_required", pa.utf8(), False, {}), + pa.field("single_string_optional", pa.utf8(), True, {}), + pa.field("many_floats_optional", pa.list_(pa.field("item", pa.float32(), True, {})), True, {}), + pa.field("many_strings_required", pa.list_(pa.field("item", pa.utf8(), False, {})), False, {}), + pa.field("many_strings_optional", pa.list_(pa.field("item", pa.utf8(), True, {})), True, {}), + ] + ), + "rerun.testing.datatypes.AffixFuzzer1", + ) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer1Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer1Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer1Type()) + + +class AffixFuzzer1Array(pa.ExtensionArray, AffixFuzzer1ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer1ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer1Type().wrap_array(pa.array([], type=AffixFuzzer1Type().storage_type)) + else: + return AffixFuzzer1ArrayExt._from_similar( + data, + mono=AffixFuzzer1, + mono_aliases=AffixFuzzer1Like, + many=AffixFuzzer1Array, + many_aliases=AffixFuzzer1ArrayLike, + arrow=AffixFuzzer1Type, + ) + + +## --- AffixFuzzer2 --- ## + + +@dataclass +class AffixFuzzer2: + single_float_optional: float | None = None + + def __array__(self) -> npt.ArrayLike: + return np.asarray(self.single_float_optional) + + +AffixFuzzer2Like = AffixFuzzer2 +AffixFuzzer2ArrayLike = Union[ + AffixFuzzer2Like, + Sequence[AffixFuzzer2Like], +] + + +# --- Arrow support --- + +from .fuzzy_ext import AffixFuzzer2ArrayExt # noqa: E402 + + +class AffixFuzzer2Type(pa.ExtensionType): # type: ignore[misc] + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__(self, pa.float32(), "rerun.testing.datatypes.AffixFuzzer2") + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + # since we don't have a parameterized type, we don't need extra metadata to be deserialized + return b"" + + @classmethod + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + # return an instance of this subclass given the serialized metadata. + return AffixFuzzer2Type() + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return AffixFuzzer2Array + + +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(AffixFuzzer2Type()) + + +class AffixFuzzer2Array(pa.ExtensionArray, AffixFuzzer2ArrayExt): # type: ignore[misc] + @staticmethod + def from_similar(data: AffixFuzzer2ArrayLike | None) -> pa.Array: + if data is None: + return AffixFuzzer2Type().wrap_array(pa.array([], type=AffixFuzzer2Type().storage_type)) + else: + return AffixFuzzer2ArrayExt._from_similar( + data, + mono=AffixFuzzer2, + mono_aliases=AffixFuzzer2Like, + many=AffixFuzzer2Array, + many_aliases=AffixFuzzer2ArrayLike, + arrow=AffixFuzzer2Type, + ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/fuzzy_ext.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/fuzzy_ext.py new file mode 100644 index 000000000000..bae6a5c15ca0 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/fuzzy_ext.py @@ -0,0 +1,26 @@ +from __future__ import annotations + +__all__ = [ + "AffixFuzzer1ArrayExt", + "AffixFuzzer2ArrayExt", +] + +from typing import Any + +import pyarrow as pa + + +class AffixFuzzer1ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError() + + +class AffixFuzzer2ArrayExt: + @staticmethod + def _from_similar( + data: Any | None, *, mono: type, mono_aliases: Any, many: type, many_aliases: Any, arrow: type + ) -> pa.Array: + raise NotImplementedError()