Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add any_values and extra_values snippets for rust #8718

Merged
merged 5 commits into from
Jan 17, 2025
Merged

Conversation

teh-cmc
Copy link
Member

@teh-cmc teh-cmc commented Jan 16, 2025

With the new SerializedComponentBatch acting as the core logging type in Rust, we can now emulate Python's AnyValues with little efforts.

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let rec = rerun::RecordingStreamBuilder::new("rerun_example_any_values").spawn()?;

    let confidences = rerun::SerializedComponentBatch::new(
        Arc::new(arrow::array::Float64Array::from(vec![1.2, 3.4, 5.6])),
        rerun::ComponentDescriptor::new("confidence"),
    );

    let description = rerun::SerializedComponentBatch::new(
        Arc::new(arrow::array::StringArray::from(vec!["Bla bla bla…"])),
        rerun::ComponentDescriptor::new("description"),
    );

    rec.log("any_values", &[confidences, description])?;

    Ok(())
}

@teh-cmc teh-cmc added 🦀 Rust API Rust logging API include in changelog 🪵 Log & send APIs Affects the user-facing API for all languages labels Jan 16, 2025
Copy link

github-actions bot commented Jan 16, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
d7bd306 https://rerun.io/viewer/pr/8718 +nightly +main

Note: This comment is updated whenever you push a commit.

@teh-cmc teh-cmc force-pushed the cmc/any_values_rust branch from b065566 to d7bd306 Compare January 17, 2025 08:13
@teh-cmc teh-cmc merged commit cae7a6a into main Jan 17, 2025
28 of 30 checks passed
@teh-cmc teh-cmc deleted the cmc/any_values_rust branch January 17, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include in changelog 🪵 Log & send APIs Affects the user-facing API for all languages 🦀 Rust API Rust logging API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants