Skip to content

Commit

Permalink
Make Datatype & Component both inherit from Loggable (#2677)
Browse files Browse the repository at this point in the history
**commit by commit!**

### 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/2677) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2677)
- [Docs
preview](https://rerun.io/preview/pr%3Acmc%2Fdatatype_component_are_one_and_the_sanme/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Acmc%2Fdatatype_component_are_one_and_the_sanme/examples)
  • Loading branch information
teh-cmc authored Jul 12, 2023
1 parent 456e0ba commit 9589002
Show file tree
Hide file tree
Showing 31 changed files with 386 additions and 371 deletions.
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.
73588bbdd10b7303d8d04bda573c315fd2acb3cd3edd2ee5244a926064c8dc46
d86ab89fae71ae9a5f145017617c8bdb8f1f65355e5788eff6b2c88ee3a9081b
4 changes: 2 additions & 2 deletions crates/re_types/src/archetypes/fuzzy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl crate::Archetype for AffixFuzzer1 {
) -> crate::SerializationResult<
Vec<(::arrow2::datatypes::Field, Box<dyn ::arrow2::array::Array>)>,
> {
use crate::Component as _;
use crate::Loggable as _;
Ok([
{
Some({
Expand Down Expand Up @@ -1592,7 +1592,7 @@ impl crate::Archetype for AffixFuzzer1 {
fn try_from_arrow(
data: impl IntoIterator<Item = (::arrow2::datatypes::Field, Box<dyn ::arrow2::array::Array>)>,
) -> crate::DeserializationResult<Self> {
use crate::Component as _;
use crate::Loggable as _;
let arrays_by_name: ::std::collections::HashMap<_, _> = data
.into_iter()
.map(|(field, array)| (field.name, array))
Expand Down
4 changes: 2 additions & 2 deletions crates/re_types/src/archetypes/points2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl crate::Archetype for Points2D {
) -> crate::SerializationResult<
Vec<(::arrow2::datatypes::Field, Box<dyn ::arrow2::array::Array>)>,
> {
use crate::Component as _;
use crate::Loggable as _;
Ok([
{
Some({
Expand Down Expand Up @@ -301,7 +301,7 @@ impl crate::Archetype for Points2D {
fn try_from_arrow(
data: impl IntoIterator<Item = (::arrow2::datatypes::Field, Box<dyn ::arrow2::array::Array>)>,
) -> crate::DeserializationResult<Self> {
use crate::Component as _;
use crate::Loggable as _;
let arrays_by_name: ::std::collections::HashMap<_, _> = data
.into_iter()
.map(|(field, array)| (field.name, array))
Expand Down
4 changes: 2 additions & 2 deletions crates/re_types/src/archetypes/transform3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl crate::Archetype for Transform3D {
) -> crate::SerializationResult<
Vec<(::arrow2::datatypes::Field, Box<dyn ::arrow2::array::Array>)>,
> {
use crate::Component as _;
use crate::Loggable as _;
Ok([{
Some({
let array = <crate::components::Transform3D>::try_to_arrow([&self.transform], None);
Expand All @@ -88,7 +88,7 @@ impl crate::Archetype for Transform3D {
fn try_from_arrow(
data: impl IntoIterator<Item = (::arrow2::datatypes::Field, Box<dyn ::arrow2::array::Array>)>,
) -> crate::DeserializationResult<Self> {
use crate::Component as _;
use crate::Loggable as _;
let arrays_by_name: ::std::collections::HashMap<_, _> = data
.into_iter()
.map(|(field, array)| (field.name, array))
Expand Down
11 changes: 7 additions & 4 deletions crates/re_types/src/components/class_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ impl<'a> From<&'a ClassId> for ::std::borrow::Cow<'a, ClassId> {
}
}

impl crate::Component for ClassId {
impl crate::Loggable for ClassId {
type Name = crate::ComponentName;
#[inline]
fn name() -> crate::ComponentName {
fn name() -> Self::Name {
crate::ComponentName::Borrowed("rerun.class_id")
}

Expand All @@ -53,7 +54,7 @@ impl crate::Component for ClassId {
where
Self: Clone + 'a,
{
use crate::{Component as _, Datatype as _};
use crate::Loggable as _;
use ::arrow2::{array::*, datatypes::*};
Ok({
let (somes, data0): (Vec<_>, Vec<_>) = data
Expand Down Expand Up @@ -96,7 +97,7 @@ impl crate::Component for ClassId {
where
Self: Sized,
{
use crate::{Component as _, Datatype as _};
use crate::Loggable as _;
use ::arrow2::{array::*, datatypes::*};
Ok(data
.as_any()
Expand All @@ -113,3 +114,5 @@ impl crate::Component for ClassId {
.collect::<crate::DeserializationResult<Vec<Option<_>>>>()?)
}
}

impl crate::Component for ClassId {}
11 changes: 7 additions & 4 deletions crates/re_types/src/components/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ impl<'a> From<&'a Color> for ::std::borrow::Cow<'a, Color> {
}
}

impl crate::Component for Color {
impl crate::Loggable for Color {
type Name = crate::ComponentName;
#[inline]
fn name() -> crate::ComponentName {
fn name() -> Self::Name {
crate::ComponentName::Borrowed("rerun.colorrgba")
}

Expand All @@ -63,7 +64,7 @@ impl crate::Component for Color {
where
Self: Clone + 'a,
{
use crate::{Component as _, Datatype as _};
use crate::Loggable as _;
use ::arrow2::{array::*, datatypes::*};
Ok({
let (somes, data0): (Vec<_>, Vec<_>) = data
Expand Down Expand Up @@ -106,7 +107,7 @@ impl crate::Component for Color {
where
Self: Sized,
{
use crate::{Component as _, Datatype as _};
use crate::Loggable as _;
use ::arrow2::{array::*, datatypes::*};
Ok(data
.as_any()
Expand All @@ -123,3 +124,5 @@ impl crate::Component for Color {
.collect::<crate::DeserializationResult<Vec<Option<_>>>>()?)
}
}

impl crate::Component for Color {}
11 changes: 7 additions & 4 deletions crates/re_types/src/components/draw_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ impl<'a> From<&'a DrawOrder> for ::std::borrow::Cow<'a, DrawOrder> {
}
}

impl crate::Component for DrawOrder {
impl crate::Loggable for DrawOrder {
type Name = crate::ComponentName;
#[inline]
fn name() -> crate::ComponentName {
fn name() -> Self::Name {
crate::ComponentName::Borrowed("rerun.draw_order")
}

Expand All @@ -58,7 +59,7 @@ impl crate::Component for DrawOrder {
where
Self: Clone + 'a,
{
use crate::{Component as _, Datatype as _};
use crate::Loggable as _;
use ::arrow2::{array::*, datatypes::*};
Ok({
let (somes, data0): (Vec<_>, Vec<_>) = data
Expand Down Expand Up @@ -101,7 +102,7 @@ impl crate::Component for DrawOrder {
where
Self: Sized,
{
use crate::{Component as _, Datatype as _};
use crate::Loggable as _;
use ::arrow2::{array::*, datatypes::*};
Ok(data
.as_any()
Expand All @@ -118,3 +119,5 @@ impl crate::Component for DrawOrder {
.collect::<crate::DeserializationResult<Vec<Option<_>>>>()?)
}
}

impl crate::Component for DrawOrder {}
Loading

1 comment on commit 9589002

@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: 9589002 Previous: cb39601 Ratio
batch_points_arrow/encode_log_msg 90173 ns/iter (± 184) 49181 ns/iter (± 629) 1.83

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

Please sign in to comment.