Skip to content

Commit

Permalink
VisibleTimeRange is now a union, add serialization comparision test (
Browse files Browse the repository at this point in the history
…#6259)

### What

Part of a train 
* #6257
* #6258
* ➡️ #6259

Replaces a fair chunk of
* #6221

Makes `VisibleTimeRange` a union - the motivator for this pr train in
the first place. Adds a roundtrip test that compares the serialization
of`VisibleTimeRange` archetype across sdk languages. (the archetype is
meant for blueprint only, but I'm simply using the datastore for this
comparision)

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6259?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6259?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/6259)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
Wumpf authored May 8, 2024
1 parent 4511814 commit 9029698
Show file tree
Hide file tree
Showing 46 changed files with 808 additions and 862 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/blueprint.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include "./blueprint/archetypes/panel_blueprint.fbs";
include "./blueprint/archetypes/space_view_blueprint.fbs";
include "./blueprint/archetypes/space_view_contents.fbs";
include "./blueprint/archetypes/viewport_blueprint.fbs";
include "./blueprint/archetypes/visible_time_range.fbs";
include "./blueprint/archetypes/visible_time_ranges.fbs";
include "./blueprint/archetypes/visual_bounds.fbs";

include "./blueprint/archetypes/plot_legend.fbs";
Expand Down
24 changes: 7 additions & 17 deletions crates/re_types/definitions/rerun/datatypes/visible_time_range.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,25 @@ include "python/attributes.fbs";
include "rust/attributes.fbs";

include "rerun/attributes.fbs";
include "rerun/unit_type.fbs";

include "time_int.fbs";

namespace rerun.datatypes;

/// Kind of boundary for visible history, see `TimeRangeBoundary`.
enum TimeRangeBoundaryKind: byte (
/// Left or right boundary of a time range.
union TimeRangeBoundary (
"attr.rust.derive": "Copy, PartialEq, Eq",
"attr.rust.override_crate": "re_types_core"
) {
/// Boundary is a value relative to the time cursor.
RelativeToTimeCursor,
CursorRelative: TimeInt,

/// Boundary is an absolute value.
Absolute,
Absolute: TimeInt,

/// The boundary extends to infinity.
Infinite,
}

/// Type of boundary for visible history.
struct TimeRangeBoundary (
"attr.rust.derive": "Copy",
"attr.rust.override_crate": "re_types_core"
) {
/// Type of the boundary.
kind: rerun.datatypes.TimeRangeBoundaryKind (order: 100);

/// Value of the boundary (ignored for `Infinite` type).
time: rerun.datatypes.TimeInt (order: 200);
Infinite: rerun.builtins.UnitType,
}

/// Visible time range bounds for a specific timeline.
Expand Down

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

2 changes: 1 addition & 1 deletion crates/re_types_builder/src/codegen/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ fn quote_union_kind_from_fields(fields: &Vec<ObjectField>) -> String {
line.remove(0);
}
}
lines.push(format!("* {:?}:", field.name));
lines.push(format!("* {:?}:", field.snake_case_name()));
lines.extend(content.into_iter().map(|line| format!(" {line}")));
lines.push(String::new());
}
Expand Down
1 change: 0 additions & 1 deletion crates/re_types_core/src/datatypes/.gitattributes

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

2 changes: 0 additions & 2 deletions crates/re_types_core/src/datatypes/mod.rs

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

Loading

0 comments on commit 9029698

Please sign in to comment.