Struct re_sdk::RecordingStreamBuilder
source · pub struct RecordingStreamBuilder { /* private fields */ }Expand description
Construct a RecordingStream.
let rec = RecordingStreamBuilder::new("rerun_example_app").save("my_recording.rrd")?;Implementations§
source§impl RecordingStreamBuilder
impl RecordingStreamBuilder
sourcepub fn new(application_id: impl Into<ApplicationId>) -> Self
pub fn new(application_id: impl Into<ApplicationId>) -> Self
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) -> Self
pub fn default_enabled(self, default_enabled: bool) -> Self
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) -> Self
pub fn enabled(self, enabled: bool) -> Self
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>) -> Self
pub fn recording_id(self, recording_id: impl Into<String>) -> Self
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.
sourcepub fn store_id(self, store_id: StoreId) -> Self
pub fn store_id(self, store_id: StoreId) -> Self
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: DataTableBatcherConfig) -> Self
pub fn batcher_config(self, config: DataTableBatcherConfig) -> Self
Specifies the configuration of the internal data batching mechanism.
See DataTableBatcher & DataTableBatcherConfig for more information.
sourcepub fn buffered(self) -> RecordingStreamResult<RecordingStream>
pub fn buffered(self) -> RecordingStreamResult<RecordingStream>
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
) -> RecordingStreamResult<(RecordingStream, MemorySinkStorage)>
pub fn memory( self ) -> RecordingStreamResult<(RecordingStream, MemorySinkStorage)>
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) -> RecordingStreamResult<RecordingStream>
pub fn connect(self) -> RecordingStreamResult<RecordingStream>
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_opts(
self,
addr: SocketAddr,
flush_timeout: Option<Duration>
) -> RecordingStreamResult<RecordingStream>
pub fn connect_opts( self, addr: SocketAddr, flush_timeout: Option<Duration> ) -> RecordingStreamResult<RecordingStream>
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>
) -> RecordingStreamResult<RecordingStream>
pub fn save( self, path: impl Into<PathBuf> ) -> RecordingStreamResult<RecordingStream>
Creates a new RecordingStream that is pre-configured to stream the data through to an
RRD file on disk.
§Example
let rec = re_sdk::RecordingStreamBuilder::new("rerun_example_app").save("my_recording.rrd")?;sourcepub fn stdout(self) -> RecordingStreamResult<RecordingStream>
pub fn stdout(self) -> RecordingStreamResult<RecordingStream>
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) -> RecordingStreamResult<RecordingStream>
pub fn spawn(self) -> RecordingStreamResult<RecordingStream>
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>
) -> RecordingStreamResult<RecordingStream>
pub fn spawn_opts( self, opts: &SpawnOptions, flush_timeout: Option<Duration> ) -> RecordingStreamResult<RecordingStream>
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 into_args(self) -> (bool, StoreInfo, DataTableBatcherConfig)
pub fn into_args(self) -> (bool, StoreInfo, DataTableBatcherConfig)
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> 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 more