Struct rerun::sdk::RecordingStreamBuilder
source · pub struct RecordingStreamBuilder {
application_id: ApplicationId,
store_kind: StoreKind,
store_id: Option<StoreId>,
store_source: Option<StoreSource>,
default_enabled: bool,
enabled: Option<bool>,
batcher_config: Option<ChunkBatcherConfig>,
is_official_example: bool,
}
Expand description
Construct a RecordingStream
.
let rec = RecordingStreamBuilder::new("rerun_example_app").save("my_recording.rrd")?;
Fields§
§application_id: ApplicationId
§store_kind: StoreKind
§store_id: Option<StoreId>
§store_source: Option<StoreSource>
§default_enabled: bool
§enabled: Option<bool>
§batcher_config: Option<ChunkBatcherConfig>
§is_official_example: bool
Implementations§
source§impl RecordingStreamBuilder
impl RecordingStreamBuilder
sourcepub fn new(application_id: impl Into<ApplicationId>) -> RecordingStreamBuilder
pub fn new(application_id: impl Into<ApplicationId>) -> RecordingStreamBuilder
Create a new RecordingStreamBuilder
with the given ApplicationId
.
The ApplicationId
is usually the name of your app.
let rec = RecordingStreamBuilder::new("rerun_example_app").save("my_recording.rrd")?;
sourcepub fn default_enabled(self, default_enabled: bool) -> RecordingStreamBuilder
pub fn default_enabled(self, default_enabled: bool) -> RecordingStreamBuilder
Set whether or not Rerun is enabled by default.
If the RERUN
environment variable is set, it will override this.
Set also: Self::enabled
.
sourcepub fn enabled(self, enabled: bool) -> RecordingStreamBuilder
pub fn enabled(self, enabled: bool) -> RecordingStreamBuilder
Set whether or not Rerun is enabled.
Setting this will ignore the RERUN
environment variable.
Set also: Self::default_enabled
.
sourcepub fn recording_id(
self,
recording_id: impl Into<String>
) -> RecordingStreamBuilder
pub fn recording_id( self, recording_id: impl Into<String> ) -> RecordingStreamBuilder
Set the RecordingId
for this context.
If you’re logging from multiple processes and want all the messages to end up in the same
recording, you must make sure that they all set the same RecordingId
using this function.
Note that many stores can share the same ApplicationId
, but they all have
unique RecordingId
s.
The default is to use a random RecordingId
.
sourcepub fn store_id(self, store_id: StoreId) -> RecordingStreamBuilder
pub fn store_id(self, store_id: StoreId) -> RecordingStreamBuilder
Set the StoreId
for this context.
If you’re logging from multiple processes and want all the messages to end up as the same
store, you must make sure they all set the same StoreId
using this function.
Note that many stores can share the same ApplicationId
, but they all have
unique StoreId
s.
The default is to use a random StoreId
.
sourcepub fn batcher_config(
self,
config: ChunkBatcherConfig
) -> RecordingStreamBuilder
pub fn batcher_config( self, config: ChunkBatcherConfig ) -> RecordingStreamBuilder
Specifies the configuration of the internal data batching mechanism.
See ChunkBatcher
& ChunkBatcherConfig
for more information.
sourcepub fn buffered(self) -> Result<RecordingStream, RecordingStreamError>
pub fn buffered(self) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that starts in a buffering state (RAM).
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app").buffered()?;
sourcepub fn memory(
self
) -> Result<(RecordingStream, MemorySinkStorage), RecordingStreamError>
pub fn memory( self ) -> Result<(RecordingStream, MemorySinkStorage), RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to a
crate::log_sink::MemorySink
.
§Example
let (rec, storage) = re_sdk::RecordingStreamBuilder::new("rerun_example_app").memory()?;
log_data(&rec);
let data = storage.take();
sourcepub fn connect(self) -> Result<RecordingStream, RecordingStreamError>
👎Deprecated since 0.20.0: use connect_tcp() instead
pub fn connect(self) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to a
remote Rerun instance.
See also Self::connect_opts
if you wish to configure the TCP connection.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app").connect()?;
sourcepub fn connect_tcp(self) -> Result<RecordingStream, RecordingStreamError>
pub fn connect_tcp(self) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to a
remote Rerun instance.
See also Self::connect_opts
if you wish to configure the TCP connection.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app").connect_tcp()?;
sourcepub fn connect_opts(
self,
addr: SocketAddr,
flush_timeout: Option<Duration>
) -> Result<RecordingStream, RecordingStreamError>
👎Deprecated since 0.20.0: use connect_tcp_opts() instead
pub fn connect_opts( self, addr: SocketAddr, flush_timeout: Option<Duration> ) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to a
remote Rerun instance.
flush_timeout
is the minimum time the TcpSink
will
wait during a flush before potentially dropping data. Note: Passing None
here can cause a
call to flush
to block indefinitely if a connection cannot be established.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app")
.connect_opts(re_sdk::default_server_addr(), re_sdk::default_flush_timeout())?;
sourcepub fn connect_tcp_opts(
self,
addr: SocketAddr,
flush_timeout: Option<Duration>
) -> Result<RecordingStream, RecordingStreamError>
pub fn connect_tcp_opts( self, addr: SocketAddr, flush_timeout: Option<Duration> ) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to a
remote Rerun instance.
flush_timeout
is the minimum time the TcpSink
will
wait during a flush before potentially dropping data. Note: Passing None
here can cause a
call to flush
to block indefinitely if a connection cannot be established.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app")
.connect_opts(re_sdk::default_server_addr(), re_sdk::default_flush_timeout())?;
sourcepub fn save(
self,
path: impl Into<PathBuf>
) -> Result<RecordingStream, RecordingStreamError>
pub fn save( self, path: impl Into<PathBuf> ) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to an
RRD file on disk.
The Rerun Viewer is able to read continuously from the resulting rrd file while it is being written.
However, depending on your OS and configuration, changes may not be immediately visible due to file caching.
This is a common issue on Windows and (to a lesser extent) on MacOS
.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app").save("my_recording.rrd")?;
sourcepub fn stdout(self) -> Result<RecordingStream, RecordingStreamError>
pub fn stdout(self) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to stdout.
If there isn’t any listener at the other end of the pipe, the RecordingStream
will
default back to buffered
mode, in order not to break the user’s terminal.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app").stdout()?;
sourcepub fn spawn(self) -> Result<RecordingStream, RecordingStreamError>
pub fn spawn(self) -> Result<RecordingStream, RecordingStreamError>
Spawns a new Rerun Viewer process from an executable available in PATH, then creates a new
RecordingStream
that is pre-configured to stream the data through to that viewer over TCP.
If a Rerun Viewer is already listening on this TCP port, the stream will be redirected to that viewer instead of starting a new one.
See also Self::spawn_opts
if you wish to configure the behavior of thew Rerun process
as well as the underlying TCP connection.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app").spawn()?;
sourcepub fn spawn_opts(
self,
opts: &SpawnOptions,
flush_timeout: Option<Duration>
) -> Result<RecordingStream, RecordingStreamError>
pub fn spawn_opts( self, opts: &SpawnOptions, flush_timeout: Option<Duration> ) -> Result<RecordingStream, RecordingStreamError>
Spawns a new Rerun Viewer process from an executable available in PATH, then creates a new
RecordingStream
that is pre-configured to stream the data through to that viewer over TCP.
If a Rerun Viewer is already listening on this TCP port, the stream will be redirected to that viewer instead of starting a new one.
The behavior of the spawned Viewer can be configured via opts
.
If you’re fine with the default behavior, refer to the simpler Self::spawn
.
flush_timeout
is the minimum time the TcpSink
will
wait during a flush before potentially dropping data. Note: Passing None
here can cause a
call to flush
to block indefinitely if a connection cannot be established.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app")
.spawn_opts(&re_sdk::SpawnOptions::default(), re_sdk::default_flush_timeout())?;
sourcepub fn serve(
self,
bind_ip: &str,
web_port: WebViewerServerPort,
ws_port: RerunServerPort,
server_memory_limit: MemoryLimit,
open_browser: bool
) -> Result<RecordingStream, RecordingStreamError>
👎Deprecated since 0.20.0: use serve_web() instead
pub fn serve( self, bind_ip: &str, web_port: WebViewerServerPort, ws_port: RerunServerPort, server_memory_limit: MemoryLimit, open_browser: bool ) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to a
web-based Rerun viewer via WebSockets.
If the open_browser
argument is true
, your default browser will be opened with a
connected web-viewer.
If not, you can connect to this server using the rerun
binary (cargo install rerun-cli --locked
).
§Details
This method will spawn two servers: one HTTPS server serving the Rerun Web Viewer .html
and .wasm
files,
and then one WebSocket server that streams the log data to the web viewer (or to a native viewer, or to multiple viewers).
The WebSocket server will buffer all log data in memory so that late connecting viewers will get all the data.
You can limit the amount of data buffered by the WebSocket server with the server_memory_limit
argument.
Once reached, the earliest logged data will be dropped.
Note that this means that static data may be dropped if logged early (see https://github.com/rerun-io/rerun/issues/5531).
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app")
.serve("0.0.0.0",
Default::default(),
Default::default(),
re_sdk::MemoryLimit::from_fraction_of_total(0.25),
true)?;
sourcepub fn serve_web(
self,
bind_ip: &str,
web_port: WebViewerServerPort,
ws_port: RerunServerPort,
server_memory_limit: MemoryLimit,
open_browser: bool
) -> Result<RecordingStream, RecordingStreamError>
pub fn serve_web( self, bind_ip: &str, web_port: WebViewerServerPort, ws_port: RerunServerPort, server_memory_limit: MemoryLimit, open_browser: bool ) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream
that is pre-configured to stream the data through to a
web-based Rerun viewer via WebSockets.
If the open_browser
argument is true
, your default browser will be opened with a
connected web-viewer.
If not, you can connect to this server using the rerun
binary (cargo install rerun-cli --locked
).
§Details
This method will spawn two servers: one HTTPS server serving the Rerun Web Viewer .html
and .wasm
files,
and then one WebSocket server that streams the log data to the web viewer (or to a native viewer, or to multiple viewers).
The WebSocket server will buffer all log data in memory so that late connecting viewers will get all the data.
You can limit the amount of data buffered by the WebSocket server with the server_memory_limit
argument.
Once reached, the earliest logged data will be dropped.
Note that this means that static data may be dropped if logged early (see https://github.com/rerun-io/rerun/issues/5531).
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app")
.serve_web("0.0.0.0",
Default::default(),
Default::default(),
re_sdk::MemoryLimit::from_fraction_of_total(0.25),
true)?;
sourcepub fn into_args(self) -> (bool, StoreInfo, ChunkBatcherConfig)
pub fn into_args(self) -> (bool, StoreInfo, ChunkBatcherConfig)
Returns whether or not logging is enabled, a StoreInfo
and the associated batcher
configuration.
This can be used to then construct a RecordingStream
manually using
RecordingStream::new
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RecordingStreamBuilder
impl !RefUnwindSafe for RecordingStreamBuilder
impl Send for RecordingStreamBuilder
impl Sync for RecordingStreamBuilder
impl Unpin for RecordingStreamBuilder
impl !UnwindSafe for RecordingStreamBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request