Skip to content

Commit

Permalink
More docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed May 14, 2024
1 parent 32848b0 commit bc12f57
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/re_data_source/src/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use anyhow::Context as _;
pub enum DataSource {
/// A remote RRD file, served over http.
///
/// If `follow` is `true`, the viewer will open the stream in `Following` mode rather than `Playing` mode.
///
/// Could be either an `.rrd` recording or a `.rbl` blueprint.
RrdHttpUrl { url: String, follow: bool },

Expand Down
5 changes: 5 additions & 0 deletions crates/re_log_encoding/src/stream_rrd_from_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ use std::sync::Arc;
use re_log::ResultExt as _;
use re_log_types::LogMsg;

/// Stream an rrd file from a HTTP server.
///
/// If `follow_if_http` is `true`, and the url is an HTTP source, the viewer will open the stream
/// in `Following` mode rather than `Playing` mode.
///
/// `on_msg` can be used to wake up the UI thread on Wasm.
pub fn stream_rrd_from_http_to_channel(
url: String,
Expand Down
2 changes: 2 additions & 0 deletions crates/re_smart_channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pub enum SmartChannelSource {
File(std::path::PathBuf),

/// The channel was created in the context of loading an `.rrd` file over http.
///
/// The `follow` flag indicates whether the viewer should open the stream in `Following` mode rather than `Playing` mode.
RrdHttpStream { url: String, follow: bool },

/// The channel was created in the context of loading an `.rrd` file from a `postMessage`
Expand Down
8 changes: 8 additions & 0 deletions crates/re_viewer/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ impl WebHandle {
self.runner.panic_summary().map(|s| s.callstack())
}

/// Add a new receiver streaming data from the given url.
///
/// If `follow_if_http` is `true`, and the url is an HTTP source, the viewer will open the stream
/// in `Following` mode rather than `Playing` mode.
///
/// Websocket streams are always opened in `Following` mode.
///
/// It is an error to open a channel twice with the same id.
#[wasm_bindgen]
pub fn add_receiver(&self, url: &str, follow_if_http: Option<bool>) {
let Some(mut app) = self.runner.app_mut::<crate::App>() else {
Expand Down
3 changes: 2 additions & 1 deletion rerun_js/web-viewer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export class WebViewer {
* @see {WebViewer.start}
*
* @param {string | string[]} rrd URLs to `.rrd` files or WebSocket connections to our SDK.
* @param {boolean} [follow_if_http] Whether Rerun should enter "follow" mode when streaming from an HTTP url. Defaults to `false`. Ignored for non-HTTP URLs.
* @param {boolean} [follow_if_http] Whether Rerun should open the resource in "Following" mode when streaming
* from an HTTP url. Defaults to `false`. Ignored for non-HTTP URLs.
*/
open(rrd, follow_if_http = false) {
if (!this.#handle) {
Expand Down

0 comments on commit bc12f57

Please sign in to comment.