Skip to content

Commit

Permalink
backporting misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Dec 4, 2024
1 parent 7f30e5a commit a20cd08
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
7 changes: 1 addition & 6 deletions crates/store/re_types_core/src/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,7 @@ impl<A: Archetype> crate::ComponentBatch for GenericIndicatorComponent<A> {
fn descriptor(&self) -> Cow<'_, ComponentDescriptor> {
let component_name =
format!("{}Indicator", A::name().full_name()).replace("archetypes", "components");
ComponentDescriptor {
archetype_name: Some(A::name()),
archetype_field_name: None,
component_name: component_name.into(),
}
.into()
ComponentDescriptor::new(component_name).into()
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/all/descriptors/descr_builtin_archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rerun::{ChunkStore, ChunkStoreConfig, ComponentDescriptor, VersionPolicy};

#[allow(clippy::unwrap_used)]
fn main() -> Result<(), Box<dyn std::error::Error>> {
const APP_ID: &str = "rerun_example_descriptors_builtin_archetype_vanilla";
const APP_ID: &str = "rerun_example_descriptors_builtin_archetype";

let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?;

Expand Down Expand Up @@ -42,7 +42,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let expected = vec![
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Points3D".into()),
archetype_name: None,
archetype_field_name: None,
component_name: "rerun.components.Points3DIndicator".into(),
},
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/descriptors/descr_builtin_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rerun::{ChunkStore, ChunkStoreConfig, Component as _, ComponentDescriptor, V

#[allow(clippy::unwrap_used)]
fn main() -> Result<(), Box<dyn std::error::Error>> {
const APP_ID: &str = "rerun_example_descriptors_builtin_component_vanilla";
const APP_ID: &str = "rerun_example_descriptors_builtin_component";

let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?;

Expand Down
20 changes: 16 additions & 4 deletions docs/snippets/all/descriptors/descr_custom_archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl rerun::AsComponents for CustomPoints3D {

#[allow(clippy::unwrap_used)]
fn main() -> Result<(), Box<dyn std::error::Error>> {
const APP_ID: &str = "rerun_example_descriptors_custom_component_vanilla";
const APP_ID: &str = "rerun_example_descriptors_custom_archetype";

let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?;

Expand Down Expand Up @@ -126,9 +126,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
descriptors.sort();

let expected = vec![
rerun::ComponentBatch::descriptor(&CustomPoints3D::indicator()).into_owned(),
CustomPoints3D::overridden_color_descriptor(),
CustomPoints3D::overridden_position_descriptor(),
ComponentDescriptor {
archetype_name: None,
archetype_field_name: None,
component_name: "user.CustomPoints3DIndicator".into(),
},
ComponentDescriptor {
archetype_name: Some("user.CustomArchetype".into()),
archetype_field_name: Some("colors".into()),
component_name: rerun::components::Color::name(),
},
ComponentDescriptor {
archetype_name: Some("user.CustomArchetype".into()),
archetype_field_name: Some("positions".into()),
component_name: "user.CustomPosition3D".into(),
},
];

similar_asserts::assert_eq!(expected, descriptors);
Expand Down
10 changes: 8 additions & 2 deletions docs/snippets/all/descriptors/descr_custom_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Component for CustomPosition3D {

#[allow(clippy::unwrap_used)]
fn main() -> Result<(), Box<dyn std::error::Error>> {
const APP_ID: &str = "rerun_example_descriptors_custom_component_vanilla";
const APP_ID: &str = "rerun_example_descriptors_custom_component";

let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?;

Expand Down Expand Up @@ -81,7 +81,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.collect::<Vec<_>>();
descriptors.sort();

let expected = vec![CustomPosition3D::descriptor()];
let expected = vec![
ComponentDescriptor {
archetype_name: Some("user.CustomArchetype".into()),
archetype_field_name: Some("user.CustomArchetypeField".into()),
component_name: "user.CustomPosition3D".into(),
}, //
];

similar_asserts::assert_eq!(expected, descriptors);
}
Expand Down

0 comments on commit a20cd08

Please sign in to comment.