Skip to content

Commit

Permalink
Automatically derive tuple_struct attr and trivial From impls whe…
Browse files Browse the repository at this point in the history
…re possible (#2772)

**Commit by commit!**

What the title says.

Fixes #2675
Fixes #2771 

### What

### 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 [demo.rerun.io](https://demo.rerun.io/pr/2772) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2772)
- [Docs
preview](https://rerun.io/preview/pr%3Acmc%2Fnicer_components_rust/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Acmc%2Fnicer_components_rust/examples)
  • Loading branch information
teh-cmc authored Jul 21, 2023
1 parent ccd0481 commit 90d8c39
Show file tree
Hide file tree
Showing 19 changed files with 467 additions and 550 deletions.
2 changes: 1 addition & 1 deletion crates/re_space_view_spatial/src/parts/points2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Points2DPart {
(point, Some(label)) => Some(UiLabel {
text: label,
color: *color,
target: UiLabelTarget::Point2D(egui::pos2(point.xy.x, point.xy.y)),
target: UiLabelTarget::Point2D(egui::pos2(point.x(), point.y())),
labeled_instance: *labeled_instance,
}),
_ => None,
Expand Down
1 change: 0 additions & 1 deletion crates/re_types/definitions/rerun/components/class_id.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ struct ClassId (
"attr.python.array_aliases": "int, npt.NDArray[np.uint8], npt.NDArray[np.uint16], npt.NDArray[np.uint32], npt.NDArray[np.uint64]",
"attr.rerun.legacy_fqname": "rerun.class_id",
"attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash",
"attr.rust.tuple_struct",
order: 100
) {
id: ushort (order: 100);
Expand Down
1 change: 0 additions & 1 deletion crates/re_types/definitions/rerun/components/color.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ struct Color (
"attr.rerun.legacy_fqname": "rerun.colorrgba",
"attr.rust.derive": "Default, Copy, PartialEq, Eq, PartialOrd, Ord, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct",
order: 100
) {
rgba: uint (order: 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct DrawOrder (
"attr.rerun.legacy_fqname": "rerun.draw_order",
"attr.rust.derive": "Copy",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct",
order: 100
) {
value: float (order: 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ struct InstanceKey (
"attr.python.aliases": "int",
"attr.python.array_aliases": "int, npt.NDArray[np.uint64]",
"attr.rerun.legacy_fqname": "rerun.instance_key",
"attr.rust.tuple_struct",
"attr.rust.derive": "Copy, Hash, PartialEq, Eq, PartialOrd, Ord",
order: 100
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct KeypointId (
"attr.python.array_aliases": "float, npt.NDArray[np.uint8], npt.NDArray[np.uint16], npt.NDArray[np.uint32]",
"attr.rerun.legacy_fqname": "rerun.keypoint_id",
"attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash",
"attr.rust.tuple_struct",
order: 200
) {
id: ushort (order: 100);
Expand Down
1 change: 0 additions & 1 deletion crates/re_types/definitions/rerun/components/label.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ table Label (
"attr.rerun.legacy_fqname": "rerun.label",
"attr.rust.derive": "PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct",
order: 100
) {
value: string (order: 100);
Expand Down
1 change: 0 additions & 1 deletion crates/re_types/definitions/rerun/components/point2d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace rerun.components;
// ---

/// A point in 2D space.
// TODO(cmc): bring back attr.rust.tuple_struct
struct Point2D (
"attr.python.aliases": "npt.NDArray[np.float32], Sequence[float], Tuple[float, float]",
"attr.python.array_aliases": "npt.NDArray[np.float32], Sequence[float]",
Expand Down
1 change: 0 additions & 1 deletion crates/re_types/definitions/rerun/components/radius.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ struct Radius (
"attr.python.aliases": "float",
"attr.python.array_aliases": "float, npt.NDArray[np.float32]",
"attr.rerun.legacy_fqname": "rerun.radius",
"attr.rust.tuple_struct",
"attr.rust.derive": "Copy, PartialEq, PartialOrd",
order: 100
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ table Transform3D (
// wrong schema for this component.
//"attr.rerun.legacy_fqname": "rerun.transform3d",
"attr.rust.derive": "PartialEq",
"attr.rust.tuple_struct",
order: 100
) {
/// Representation of the transform.
Expand Down
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.
4e7bff9578be94c0d8e42808d39c49e58b03a4b6dd5dd571dbf87ed7640fcca4
b4f2c2b3b6518fd5c5b8fe2255952c6986895efe58cbc6ae0b56b0384a9ad930
Loading

1 comment on commit 90d8c39

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.25.

Benchmark suite Current: 90d8c39 Previous: ccd0481 Ratio
batch_points_arrow/encode_log_msg 89293 ns/iter (± 157) 52579 ns/iter (± 264) 1.70

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.