Skip to content

Commit

Permalink
add shared_recording example
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 29, 2023
1 parent ac8e880 commit 376df07
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions examples/rust/shared_recording/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "shared_recording"
version = "0.12.0-alpha.1+dev"
edition = "2021"
rust-version = "1.72"
license = "MIT OR Apache-2.0"
publish = false

[dependencies]
rerun = { path = "../../../crates/rerun" }
19 changes: 19 additions & 0 deletions examples/rust/shared_recording/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Shared Recording
rust: https://github.com/rerun-io/rerun/tree/latest/examples/python/shared_recording/main.py?speculative-link
---

<picture>
<img src="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/full.png" alt="">
<source media="(max-width: 480px)" srcset="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/shared_recording/c3da85f1d4c158b8c7afb6bd3278db000b58049d/1200w.png">
</picture>

This example demonstrates how to use `RecordingId`s to create a single shared recording across multiple processes.

Run the following multiple times, and you'll see that each invocation adds data to the existing recording rather than creating a new one:
```bash
cargo run
```
14 changes: 14 additions & 0 deletions examples/rust/shared_recording/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! Demonstrates how to use `RecordingId`s to build a single recording from multiple processes.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_shared_recording")
.recording_id("my_shared_recording")
.spawn()?;

rec.log(
"updates",
&rerun::TextLog::new(format!("hello from process #{}", std::process::id())),
)?;

Ok(())
}

0 comments on commit 376df07

Please sign in to comment.