1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! Demonstrates how to log data to standard output with the Rerun SDK, and then visualize it
//! from standard input with the Rerun Viewer.
//!
//! Usage:
//! ```text
//! echo 'hello from stdin!' | cargo run | rerun -
//! ```

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

    let input = std::io::stdin()
        .lines()
        .collect::<Result<Vec<_>, _>>()?
        .join("\n");

    rec.log("stdin", &rerun::TextDocument::new(input))?;

    Ok(())
}