-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
RecordingStream::serve
(#2815)
```rust let rec_stream = RecordingStreamBuilder::new("minimal_serve_rs").serve( "0.0.0.0", Default::default(), Default::default(), true, )?; ``` Try it with the new `minimal_serve` example: ``` $ cargo r -p minimal_serve ``` Fixes #2232 ### What ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2815) (if applicable) - [PR Build Summary](https://build.rerun.io/pr/2815) - [Docs preview](https://rerun.io/preview/pr%3Acmc%2Frecording_stream_serve/docs) - [Examples preview](https://rerun.io/preview/pr%3Acmc%2Frecording_stream_serve/examples) --------- Co-authored-by: Andreas Reich <[email protected]>
- Loading branch information
Showing
13 changed files
with
187 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "minimal_serve" | ||
version = "0.8.0-alpha.7" | ||
edition = "2021" | ||
rust-version = "1.69" | ||
license = "MIT OR Apache-2.0" | ||
publish = false | ||
|
||
[dependencies] | ||
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] } | ||
tokio = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: Minimal `serve` example | ||
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/minimal_serve/src/main.rs | ||
thumbnail: https://static.rerun.io/92a1f80b5cf2cd2c04a10d8ced35849da8f1c0ed_minimal_480w.png | ||
--- | ||
|
||
<picture> | ||
<source media="(max-width: 480px)" srcset="https://static.rerun.io/92a1f80b5cf2cd2c04a10d8ced35849da8f1c0ed_minimal_480w.png"> | ||
<source media="(max-width: 768px)" srcset="https://static.rerun.io/d78037f2306ed02505859adbae9f72d4ab2945d1_minimal_768w.png"> | ||
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/cf926c580c8ca8b39fd844f6adf4b19972b5111e_minimal_1024w.png"> | ||
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/8f03efd9e918f43b5e6d9257d0f1a3cb962b3889_minimal_1200w.png"> | ||
<img src="https://static.rerun.io/0e47ac513ab25d56cf2b493128097d499a07e5e8_minimal_full.png" alt="Minimal example screenshot"> | ||
</picture> | ||
|
||
The simplest example of how to use Rerun with its Web-based UI, showing how to log a point cloud. | ||
|
||
```bash | ||
cargo run --release | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//! Demonstrates the most barebone usage of the Rerun SDK. | ||
use rerun::{ | ||
components::{ColorRGBA, Point3D, Radius}, | ||
demo_util::grid, | ||
external::glam, | ||
MsgSender, RecordingStreamBuilder, | ||
}; | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
// `serve()` requires to have a running Tokio runtime in the current context. | ||
let rt = tokio::runtime::Runtime::new().expect("Failed to create tokio runtime"); | ||
let _guard = rt.enter(); | ||
|
||
let rec_stream = RecordingStreamBuilder::new("minimal_serve_rs").serve( | ||
"0.0.0.0", | ||
Default::default(), | ||
Default::default(), | ||
true, | ||
)?; | ||
|
||
let points = grid(glam::Vec3::splat(-10.0), glam::Vec3::splat(10.0), 10) | ||
.map(Point3D::from) | ||
.collect::<Vec<_>>(); | ||
let colors = grid(glam::Vec3::ZERO, glam::Vec3::splat(255.0), 10) | ||
.map(|v| ColorRGBA::from_rgb(v.x as u8, v.y as u8, v.z as u8)) | ||
.collect::<Vec<_>>(); | ||
|
||
MsgSender::new("my_points") | ||
.with_component(&points)? | ||
.with_component(&colors)? | ||
.with_splat(Radius(0.5))? | ||
.send(&rec_stream)?; | ||
|
||
eprintln!("Check your browser!"); | ||
std::thread::sleep(std::time::Duration::from_secs(100000)); | ||
|
||
Ok(()) | ||
} |