pub struct RecordingStreamBuilder { /* private fields */ }Expand description
Construct a RecordingStream.
let rec = RecordingStreamBuilder::new("rerun_example_app").save("my_recording.rrd")?;Automatically sends a Chunk with the default RecordingProperties to
the sink, unless an explicit recording_id is set via RecordingStreamBuilder::recording_id.
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 RecordingIds.
The default is to use a random RecordingId.
When explicitly setting a RecordingId, the initial chunk that contains the recording
properties will not be sent.
Sourcepub fn recording_name(self, name: impl Into<String>) -> RecordingStreamBuilder
pub fn recording_name(self, name: impl Into<String>) -> RecordingStreamBuilder
Sets an optional name for the recording.
Sourcepub fn recording_started(
self,
started: impl Into<Timestamp>,
) -> RecordingStreamBuilder
pub fn recording_started( self, started: impl Into<Timestamp>, ) -> RecordingStreamBuilder
Sets an optional name for the recording.
Sourcepub fn disable_properties(self) -> RecordingStreamBuilder
👎Deprecated since 0.22.0: use send_properties instead
pub fn disable_properties(self) -> RecordingStreamBuilder
send_properties insteadDisables sending the RecordingProperties chunk.
Sourcepub fn send_properties(self, should_send: bool) -> RecordingStreamBuilder
pub fn send_properties(self, should_send: bool) -> RecordingStreamBuilder
Whether the RecordingProperties chunk should be sent.
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 StoreIds.
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_grpc(self) -> Result<RecordingStream, RecordingStreamError>
pub fn connect_grpc(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_grpc_opts if you wish to configure the connection.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app").connect_grpc()?;Sourcepub fn connect_grpc_opts(
self,
url: impl Into<String>,
flush_timeout: Option<Duration>,
) -> Result<RecordingStream, RecordingStreamError>
pub fn connect_grpc_opts( self, url: impl Into<String>, 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 GrpcSink 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_grpc_opts("rerun+http://127.0.0.1:9876/proxy", re_sdk::default_flush_timeout())?;Sourcepub fn serve_grpc(self) -> Result<RecordingStream, RecordingStreamError>
pub fn serve_grpc(self) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream that is pre-configured to stream the data through to a
locally hosted gRPC server.
The server is hosted on the default IP and port, and may be connected to by any SDK or Viewer
at rerun+http://127.0.0.1:9876/proxy or by just running rerun --connect.
To configure the gRPC server’s IP and port, use Self::serve_grpc_opts instead.
The gRPC server will buffer in memory so that late connecting viewers will still get all the data.
You can limit the amount of data buffered by the gRPC server using Self::serve_grpc_opts,
with the server_memory_limit argument. Once the memory limit is reached, the earliest logged data
will be dropped. Static data is never dropped.
Sourcepub fn serve_grpc_opts(
self,
bind_ip: impl AsRef<str>,
port: u16,
server_memory_limit: MemoryLimit,
) -> Result<RecordingStream, RecordingStreamError>
pub fn serve_grpc_opts( self, bind_ip: impl AsRef<str>, port: u16, server_memory_limit: MemoryLimit, ) -> Result<RecordingStream, RecordingStreamError>
Creates a new RecordingStream that is pre-configured to stream the data through to a
locally hosted gRPC server.
The server is hosted on the given bind_ip and port, may be connected to by any SDK or Viewer
at rerun+http://{bind_ip}:{port}/proxy.
0.0.0.0 is a good default for bind_ip.
The gRPC 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 gRPC server with the server_memory_limit argument.
Once reached, the earliest logged data will be dropped. Static data is never dropped.
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 gRPC.
If a Rerun Viewer is already listening on this 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 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 gRPC.
If a Rerun Viewer is already listening on this 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 GrpcSink 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,
grpc_port: u16,
server_memory_limit: MemoryLimit,
open_browser: bool,
) -> Result<RecordingStream, RecordingStreamError>
👎Deprecated since 0.20.0: use rec.serve_grpc() with rerun::serve_web_viewer() instead
pub fn serve( self, bind_ip: &str, web_port: WebViewerServerPort, grpc_port: u16, 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 gRPC.
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 gRPC server that streams the log data to the web viewer (or to a native viewer, or to multiple viewers).
The gRPC 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 gRPC server with the server_memory_limit argument.
Once reached, the earliest logged data will be dropped. Static data is never dropped.
§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,
grpc_port: u16,
server_memory_limit: MemoryLimit,
open_browser: bool,
) -> Result<RecordingStream, RecordingStreamError>
pub fn serve_web( self, bind_ip: &str, web_port: WebViewerServerPort, grpc_port: u16, 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 gRPC.
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 gRPC server that streams the log data to the web viewer (or to a native viewer, or to multiple viewers).
The gRPC 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 gRPC server with the server_memory_limit argument.
Once reached, the earliest logged data will be dropped. Static data is never dropped.
Calling serve_web is equivalent to calling Self::serve_grpc followed by crate::serve_web_viewer.
§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, Option<RecordingProperties>, ChunkBatcherConfig)
pub fn into_args( self, ) -> (bool, StoreInfo, Option<RecordingProperties>, 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>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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::RequestSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.