use rerun::{ChunkStore, ChunkStoreConfig, Component as _, ComponentDescriptor, VersionPolicy};
fn example(rec: &rerun::RecordingStream) -> Result<(), Box<dyn std::error::Error>> {
use rerun::ComponentBatch as _;
rec.log_static(
"data",
&[rerun::components::Position3D::new(1.0, 2.0, 3.0).try_serialized()?],
)?;
Ok(())
}
pub fn main(_args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
const APP_ID: &str = "rerun_example_descriptors_builtin_component";
let rec = rerun::RecordingStreamBuilder::new(APP_ID).spawn()?;
example(&rec)?;
check_tags(&rec);
Ok(())
}
#[allow(clippy::unwrap_used)]
fn check_tags(rec: &rerun::RecordingStream) {
if let Ok(path_to_rrd) = std::env::var("_RERUN_TEST_FORCE_SAVE") {
rec.flush_blocking();
let stores = ChunkStore::from_rrd_filepath(
&ChunkStoreConfig::ALL_DISABLED,
path_to_rrd,
VersionPolicy::Warn,
)
.unwrap();
assert_eq!(1, stores.len());
let store = stores.into_values().next().unwrap();
let chunks = store.iter_chunks().collect::<Vec<_>>();
assert_eq!(1, chunks.len());
let chunk = chunks.into_iter().next().unwrap();
let mut descriptors = chunk
.components()
.values()
.flat_map(|per_desc| per_desc.keys())
.cloned()
.collect::<Vec<_>>();
descriptors.sort();
let expected = vec![
ComponentDescriptor {
archetype_name: None,
archetype_field_name: None,
component_name: rerun::components::Position3D::name(),
}, ];
similar_asserts::assert_eq!(expected, descriptors);
}
}