Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Generating (de)serialization code for dense unions in Rust backend #2626

Merged
merged 13 commits into from
Jul 7, 2023
25 changes: 24 additions & 1 deletion crates/re_types/definitions/rerun/testing/archetypes/fuzzy.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ table AffixFuzzer1 (
fuzz1011: rerun.testing.components.AffixFuzzer11 ("attr.rerun.component_required", order: 1011);
fuzz1012: rerun.testing.components.AffixFuzzer12 ("attr.rerun.component_required", order: 1012);
fuzz1013: rerun.testing.components.AffixFuzzer13 ("attr.rerun.component_required", order: 1013);
fuzz1014: rerun.testing.components.AffixFuzzer14 ("attr.rerun.component_required", order: 1014);
// NOTE: nullable union -- illegal!
// fuzz1015: rerun.testing.components.AffixFuzzer15 ("attr.rerun.component_required", order: 1015);
fuzz1016: rerun.testing.components.AffixFuzzer16 ("attr.rerun.component_required", order: 1016);
fuzz1017: rerun.testing.components.AffixFuzzer17 ("attr.rerun.component_required", order: 1017);
fuzz1018: rerun.testing.components.AffixFuzzer18 ("attr.rerun.component_required", order: 1018);

fuzz1101: [rerun.testing.components.AffixFuzzer1] ("attr.rerun.component_required", order: 1101);
fuzz1102: [rerun.testing.components.AffixFuzzer2] ("attr.rerun.component_required", order: 1102);
Expand All @@ -42,6 +48,12 @@ table AffixFuzzer1 (
fuzz1111: [rerun.testing.components.AffixFuzzer11] ("attr.rerun.component_required", order: 1111);
fuzz1112: [rerun.testing.components.AffixFuzzer12] ("attr.rerun.component_required", order: 1112);
fuzz1113: [rerun.testing.components.AffixFuzzer13] ("attr.rerun.component_required", order: 1113);
fuzz1114: [rerun.testing.components.AffixFuzzer14] ("attr.rerun.component_required", order: 1114);
// NOTE: nullable union -- illegal!
// fuzz1115: [rerun.testing.components.AffixFuzzer15] ("attr.rerun.component_required", order: 1115);
fuzz1116: [rerun.testing.components.AffixFuzzer16] ("attr.rerun.component_required", order: 1116);
fuzz1117: [rerun.testing.components.AffixFuzzer17] ("attr.rerun.component_required", order: 1117);
fuzz1118: [rerun.testing.components.AffixFuzzer18] ("attr.rerun.component_required", order: 1118);

fuzz2001: rerun.testing.components.AffixFuzzer1 ("attr.rerun.component_optional", nullable, order: 2001);
fuzz2002: rerun.testing.components.AffixFuzzer2 ("attr.rerun.component_optional", nullable, order: 2002);
Expand All @@ -56,6 +68,12 @@ table AffixFuzzer1 (
fuzz2011: rerun.testing.components.AffixFuzzer11 ("attr.rerun.component_optional", nullable, order: 2011);
fuzz2012: rerun.testing.components.AffixFuzzer12 ("attr.rerun.component_optional", nullable, order: 2012);
fuzz2013: rerun.testing.components.AffixFuzzer13 ("attr.rerun.component_optional", nullable, order: 2013);
fuzz2014: rerun.testing.components.AffixFuzzer14 ("attr.rerun.component_optional", nullable, order: 2014);
// NOTE: nullable union -- illegal!
// fuzz2015: rerun.testing.components.AffixFuzzer15 ("attr.rerun.component_optional", nullable, order: 2015);
fuzz2016: rerun.testing.components.AffixFuzzer16 ("attr.rerun.component_optional", nullable, order: 2016);
fuzz2017: rerun.testing.components.AffixFuzzer17 ("attr.rerun.component_optional", nullable, order: 2017);
fuzz2018: rerun.testing.components.AffixFuzzer18 ("attr.rerun.component_optional", nullable, order: 2018);

fuzz2101: [rerun.testing.components.AffixFuzzer1] ("attr.rerun.component_optional", nullable, order: 2101);
fuzz2102: [rerun.testing.components.AffixFuzzer2] ("attr.rerun.component_optional", nullable, order: 2102);
Expand All @@ -70,5 +88,10 @@ table AffixFuzzer1 (
fuzz2111: [rerun.testing.components.AffixFuzzer11] ("attr.rerun.component_optional", nullable, order: 2111);
fuzz2112: [rerun.testing.components.AffixFuzzer12] ("attr.rerun.component_optional", nullable, order: 2112);
fuzz2113: [rerun.testing.components.AffixFuzzer13] ("attr.rerun.component_optional", nullable, order: 2113);
fuzz2114: [rerun.testing.components.AffixFuzzer14] ("attr.rerun.component_optional", nullable, order: 2114);
// NOTE: nullable union -- illegal!
// fuzz2115: [rerun.testing.components.AffixFuzzer15] ("attr.rerun.component_optional", nullable, order: 2115);
fuzz2116: [rerun.testing.components.AffixFuzzer16] ("attr.rerun.component_optional", nullable, order: 2116);
fuzz2117: [rerun.testing.components.AffixFuzzer17] ("attr.rerun.component_optional", nullable, order: 2117);
fuzz2118: [rerun.testing.components.AffixFuzzer18] ("attr.rerun.component_optional", nullable, order: 2118);
}

38 changes: 37 additions & 1 deletion crates/re_types/definitions/rerun/testing/components/fuzzy.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,47 @@ table AffixFuzzer13 (
many_strings_optional: [string] (nullable, order: 113);
}

table AffixFuzzer14 (
"attr.rust.derive": "PartialEq",
order: 1400
) {
single_required_union: rerun.testing.datatypes.AffixFuzzer3 (order: 114);
}

// NOTE: Illegal: union don't have top-level bitmaps! Commenting out will/should break the build.
// table AffixFuzzer15 (
// "attr.rust.derive": "PartialEq",
// order: 1500
// ) {
// single_optional_union: rerun.testing.datatypes.AffixFuzzer3 (nullable, order: 115);
// }

table AffixFuzzer16 (
"attr.rust.derive": "PartialEq",
order: 1600
) {
many_required_unions: [rerun.testing.datatypes.AffixFuzzer3] (order: 116);
}

table AffixFuzzer17 (
"attr.rust.derive": "PartialEq",
order: 1700
) {
many_optional_unions: [rerun.testing.datatypes.AffixFuzzer3] (nullable, order: 117);
}

table AffixFuzzer18 (
"attr.rust.derive": "PartialEq",
order: 1800
) {
many_optional_unions: [rerun.testing.datatypes.AffixFuzzer4] (nullable, order: 118);
}

// TODO(cmc): the ugly bug we need to take care of at some point
// table AffixFuzzer14 (
// "attr.rust.derive": "PartialEq",
// order: 1400
// ) {
//
// many_transparent_optionals: rerun.testing.datatypes.AffixFuzzer2 (order: 107);
// many_transparent_optionals: rerun.testing.datatypes.AffixFuzzer2 (nullable, order: 107);
// }
32 changes: 31 additions & 1 deletion crates/re_types/definitions/rerun/testing/datatypes/fuzzy.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ table VeryDeeplyFlattenedScalar (transparent, order: 001) {
}

table SurprisinglyShallowScalar (transparent, order: 001) {
value: FlattenedScalar (required, order: 100);
value: FlattenedScalar (order: 100);
}

table AffixFuzzer1 (
Expand All @@ -36,6 +36,10 @@ table AffixFuzzer1 (
almost_flattened_scalar: SurprisinglyShallowScalar (order: 108, transparent);
}

table __AffixFuzzer1Vec (transparent, order: 0) {
inner: [AffixFuzzer1] (order: 0);
}

table AffixFuzzer2 (
"attr.arrow.transparent",
"attr.rust.derive": "PartialEq",
Expand All @@ -44,3 +48,29 @@ table AffixFuzzer2 (
) {
single_float_optional: float (nullable, order: 101);
}

union AffixFuzzer3 (
"attr.rust.derive": "PartialEq",
order: 300
) {
degrees: FlattenedScalar (transparent, order: 100),
radians: FlattenedScalar (transparent, nullable, order: 101),
craziness: __AffixFuzzer1Vec (transparent, order: 102),
}

table __AffixFuzzer3 (transparent, order: 0) {
inner: AffixFuzzer3 (order: 0);
}

table __AffixFuzzer3Vec (transparent, order: 0) {
inner: [AffixFuzzer3] (order: 0);
}

union AffixFuzzer4 (
"attr.rust.derive": "PartialEq",
order: 300
) {
single_required: __AffixFuzzer3 (transparent, order: 100),
many_required: __AffixFuzzer3Vec (transparent, order: 101),
many_optional: __AffixFuzzer3Vec (transparent, order: 102, nullable),
}
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt
Original file line number Diff line number Diff line change
@@ -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.
b0b0d5d6d0f4131e52331303a2c2dfdfa11e03936e97242ef897c2b158979273
51e4e1d21a853de2f4d3b55d7d34d75cb3d6f0f7c01b701e9750256c759e9827
Loading