//! DO NOT EDIT! This file was autogenerated by `docs/snippets/build.rs`. The original is in `/home/runner/work/rerun/rerun/docs/snippets/all/archetypes/annotation_context_rects.rs`.
//! Log rectangles with different colors and labels using annotation context
pub fn main(_args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
let rec =
rerun::RecordingStreamBuilder::new("rerun_example_annotation_context_rects").spawn()?;
// Log an annotation context to assign a label and color to each class
rec.log_static(
"/",
&rerun::AnnotationContext::new([
(1, "red", rerun::Rgba32::from_rgb(255, 0, 0)),
(2, "green", rerun::Rgba32::from_rgb(0, 255, 0)),
]),
)?;
// Log a batch of 2 rectangles with different class IDs
rec.log(
"detections",
&rerun::Boxes2D::from_mins_and_sizes([(-2., -2.), (0., 0.)], [(3., 3.), (2., 2.)])
.with_class_ids([1, 2]),
)?;
Ok(())
}