Skip to main content

RecordingStream

Struct RecordingStream 

Source
pub struct RecordingStream { /* private fields */ }
Expand description

A RecordingStream handles everything related to logging data into Rerun.

You can construct a new RecordingStream using RecordingStreamBuilder or RecordingStream::new.

§Sinks

Data is logged into Rerun via LogSinks.

The underlying LogSink of a RecordingStream can be changed at any point during its lifetime by calling RecordingStream::set_sink or one of the higher level helpers (RecordingStream::connect_grpc, RecordingStream::memory, RecordingStream::save, RecordingStream::disconnect).

See RecordingStream::set_sink for more information.

§Multithreading and ordering

RecordingStream can be cheaply cloned and used freely across any number of threads.

Internally, all operations are linearized into a pipeline:

  • All operations sent by a given thread will take effect in the same exact order as that thread originally sent them in, from its point of view.
  • There isn’t any well defined global order across multiple threads.

This means that e.g. flushing the pipeline (Self::flush_blocking) guarantees that all previous data sent by the calling thread has been recorded and (if applicable) flushed to the underlying OS-managed file descriptor, but other threads may still have data in flight.

§Shutdown

The RecordingStream can only be shutdown by dropping all instances of it, at which point it will automatically take care of flushing any pending data that might remain in the pipeline.

Shutting down cannot ever block.

Implementations§

Source§

impl RecordingStream

Source

pub fn get( kind: StoreKind, overrides: Option<RecordingStream>, ) -> Option<RecordingStream>

Returns overrides if it exists, otherwise returns the most appropriate active recording of the specified type (i.e. thread-local first, then global scope), if any.

Source

pub fn global(kind: StoreKind) -> Option<RecordingStream>

Returns the currently active recording of the specified type in the global scope, if any.

Source

pub fn set_global( kind: StoreKind, rec: Option<RecordingStream>, ) -> Option<RecordingStream>

Replaces the currently active recording of the specified type in the global scope with the specified one.

Returns the previous one, if any.

Source

pub fn forget_global(kind: StoreKind)

Forgets the currently active recording of the specified type in the global scope.

WARNING: this intentionally bypasses any drop/flush logic. This should only ever be used in cases where you know the batcher/sink threads have been lost such as in a forked process.

Source

pub fn thread_local(kind: StoreKind) -> Option<RecordingStream>

Returns the currently active recording of the specified type in the thread-local scope, if any.

Source

pub fn set_thread_local( kind: StoreKind, rec: Option<RecordingStream>, ) -> Option<RecordingStream>

Replaces the currently active recording of the specified type in the thread-local scope with the specified one.

Source

pub fn forget_thread_local(kind: StoreKind)

Forgets the currently active recording of the specified type in the thread-local scope.

WARNING: this intentionally bypasses any drop/flush logic. This should only ever be used in cases where you know the batcher/sink threads have been lost such as in a forked process.

Source§

impl RecordingStream

Source

pub fn clone_weak(&self) -> RecordingStream

Clones the RecordingStream without incrementing the refcount.

Useful e.g. if you want to make sure that a detached thread won’t prevent the RecordingStream from flushing during shutdown.

Source

pub fn ref_count(&self) -> usize

Returns the current reference count of the RecordingStream.

Returns 0 if the stream was created by RecordingStream::disabled(), or if it is a clone_weak() of a stream whose strong instances have all been dropped.

Source§

impl RecordingStream

Source

pub fn new( store_info: StoreInfo, recording_info: Option<RecordingInfo>, batcher_config: Option<ChunkBatcherConfig>, batcher_hooks: BatcherHooks, sink: Box<dyn LogSink>, ) -> Result<RecordingStream, RecordingStreamError>

Creates a new RecordingStream with a given StoreInfo and LogSink.

You can create a StoreInfo with crate::new_store_info;

The StoreInfo is immediately sent to the sink in the form of a re_log_types::SetStoreInfo.

You can find sinks in crate::sink.

If no batcher configuration is provided, the default batcher configuration for the sink will be used. Any environment variables as specified in ChunkBatcherConfig will always override respective settings.

See also: RecordingStreamBuilder.

Source

pub const fn disabled() -> RecordingStream

Creates a new no-op RecordingStream that drops all logging messages, doesn’t allocate any memory and doesn’t spawn any threads.

Self::is_enabled will return false.

Source§

impl RecordingStream

Source

pub fn log<AS>( &self, ent_path: impl Into<EntityPath>, as_components: &AS, ) -> Result<(), RecordingStreamError>
where AS: AsComponents + ?Sized,

Log data to Rerun.

This is the main entry point for logging data to rerun. It can be used to log anything that implements the AsComponents, such as any archetype or individual component.

The data will be timestamped automatically based on the RecordingStream’s internal clock. See RecordingStream::set_time_sequence etc for more information.

The entity path can either be a string (with special characters escaped, split on unescaped slashes) or an EntityPath constructed with crate::entity_path. See https://www.rerun.io/docs/concepts/logging-and-ingestion/entity-path for more on entity paths.

See also: Self::log_static for logging static data.

Internally, the stream will automatically micro-batch multiple log calls to optimize transport. See SDK Micro Batching for more information.

§Example:
rec.log(
    "my/points",
    &rerun::Points3D::new([(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)]),
)?;
§Thread Safety

While RecordingStream is Send + Sync and safe to use from multiple threads, avoid calling log while holding a std::sync::Mutex. The rerun SDK uses rayon internally for parallel processing, and rayon’s work-stealing behavior can cause deadlocks when combined with held mutexes (see rayon#592).

// ❌ Don't do this - potential deadlock:
let guard = mutex.lock().unwrap();
stream.log("data", &rerun::Points3D::new(points))?;
drop(guard);

// ✅ Do this instead - extract data first:
let points = {
    let guard = mutex.lock().unwrap();
    guard.points.clone()
};
stream.log("data", &rerun::Points3D::new(points))?;
Source

pub fn send_columns( &self, ent_path: impl Into<EntityPath>, indexes: impl IntoIterator<Item = TimeColumn>, columns: impl IntoIterator<Item = SerializedComponentColumn>, ) -> Result<(), RecordingStreamError>

Lower-level logging API to provide data spanning multiple timepoints.

Unlike the regular log API, which is row-oriented, this API lets you submit the data in a columnar form. The lengths of all of the TimeColumn and the component columns must match. All data that occurs at the same index across the different index/time and components arrays will act as a single logical row.

Note that this API ignores any stateful index/time set on the log stream via the Self::set_time/Self::set_timepoint/etc. APIs. Furthermore, this will not inject the default timelines log_tick and log_time timeline columns.

Source

pub fn log_static<AS>( &self, ent_path: impl Into<EntityPath>, as_components: &AS, ) -> Result<(), RecordingStreamError>
where AS: AsComponents + ?Sized,

Log data to Rerun.

It can be used to log anything that implements the AsComponents, such as any archetype or individual component.

Static data has no time associated with it, exists on all timelines, and unconditionally shadows any temporal data of the same type. All timestamp data associated with this message will be dropped right before sending it to Rerun.

This is most often used for rerun::ViewCoordinates and rerun::AnnotationContext.

Internally, the stream will automatically micro-batch multiple log calls to optimize transport. See SDK Micro Batching for more information.

See also Self::log.

Source

pub fn log_with_static<AS>( &self, ent_path: impl Into<EntityPath>, static_: bool, as_components: &AS, ) -> Result<(), RecordingStreamError>
where AS: AsComponents + ?Sized,

Logs the contents of a component bundle into Rerun.

If static_ is set to true, all timestamp data associated with this message will be dropped right before sending it to Rerun. Static data has no time associated with it, exists on all timelines, and unconditionally shadows any temporal data of the same type.

Otherwise, the data will be timestamped automatically based on the RecordingStream’s internal clock. See RecordingStream::set_time_* family of methods for more information.

The entity path can either be a string (with special characters escaped, split on unescaped slashes) or an EntityPath constructed with crate::entity_path. See https://www.rerun.io/docs/concepts/logging-and-ingestion/entity-path for more on entity paths.

Internally, the stream will automatically micro-batch multiple log calls to optimize transport. See SDK Micro Batching for more information.

Source

pub fn log_serialized_batches( &self, ent_path: impl Into<EntityPath>, static_: bool, comp_batches: impl IntoIterator<Item = SerializedComponentBatch>, ) -> Result<(), RecordingStreamError>

Logs a set of SerializedComponentBatches into Rerun.

If static_ is set to true, all timestamp data associated with this message will be dropped right before sending it to Rerun. Static data has no time associated with it, exists on all timelines, and unconditionally shadows any temporal data of the same type.

Otherwise, the data will be timestamped automatically based on the RecordingStream’s internal clock. See RecordingStream::set_time_* family of methods for more information.

The number of instances will be determined by the longest batch in the bundle.

The entity path can either be a string (with special characters escaped, split on unescaped slashes) or an EntityPath constructed with crate::entity_path. See https://www.rerun.io/docs/concepts/logging-and-ingestion/entity-path for more on entity paths.

Internally, the stream will automatically micro-batch multiple log calls to optimize transport. See SDK Micro Batching for more information.

Source

pub fn send_property<AS>( &self, name: impl Into<String>, values: &AS, ) -> Result<(), RecordingStreamError>
where AS: AsComponents + ?Sized,

Sends a property to the recording.

Source

pub fn send_recording_name( &self, name: impl Into<String>, ) -> Result<(), RecordingStreamError>

Sends the name of the recording.

Source

pub fn send_recording_start_time( &self, timestamp: impl Into<Timestamp>, ) -> Result<(), RecordingStreamError>

Sends the start time of the recording.

Source

pub fn log_file_from_path( &self, filepath: impl AsRef<Path>, entity_path_prefix: Option<EntityPath>, static_: bool, ) -> Result<(), RecordingStreamError>

Logs the file at the given path using all re_importer::Importers available.

A single path might be handled by more than one importer.

This method blocks until either at least one re_importer::Importer starts streaming data in or all of them fail.

See https://www.rerun.io/docs/concepts/logging-and-ingestion/importers/overview for more information.

Source

pub fn log_file_from_contents( &self, filepath: impl AsRef<Path>, contents: Cow<'_, [u8]>, entity_path_prefix: Option<EntityPath>, static_: bool, ) -> Result<(), RecordingStreamError>

Logs the given contents using all re_importer::Importers available.

A single path might be handled by more than one importer.

This method blocks until either at least one re_importer::Importer starts streaming data in or all of them fail.

See https://www.rerun.io/docs/concepts/logging-and-ingestion/importers/overview for more information.

Source§

impl RecordingStream

Source

pub fn is_enabled(&self) -> bool

Check if logging is enabled on this RecordingStream.

If not, all recording calls will be ignored.

Source

pub fn store_info(&self) -> Option<StoreInfo>

The StoreInfo associated with this RecordingStream.

Source

pub fn is_forked_child(&self) -> bool

Determine whether a fork has happened since creating this RecordingStream. In general, this means our batcher/sink threads are gone and all data logged since the fork has been dropped.

It is essential that crate::cleanup_if_forked_child be called after forking the process. SDK-implementations should do this during their initialization phase.

Source§

impl RecordingStream

Source

pub fn record_msg(&self, msg: LogMsg)

Records an arbitrary LogMsg.

Source

pub fn record_row( &self, entity_path: EntityPath, row: PendingRow, inject_time: bool, )

Records a single PendingRow.

If inject_time is set to true, the row’s timestamp data will be overridden using the RecordingStream’s internal clock.

Internally, incoming PendingRows are automatically coalesced into larger Chunks to optimize for transport.

Source

pub fn log_chunk(&self, chunk: Chunk)

Logs a single Chunk.

Will inject the log_time timeline column (and log_tick if enabled) into the chunk. If you don’t want to inject these, use Self::send_chunk instead.

Source

pub fn log_chunks(&self, chunks: impl IntoIterator<Item = Chunk>)

Logs multiple Chunks.

This will not inject log_tick and log_time timeline columns into the chunk, for that use Self::log_chunks.

Source

pub fn send_chunk(&self, chunk: Chunk)

Records a single Chunk.

This will not inject log_tick and log_time timeline columns into the chunk, for that use Self::log_chunk.

Source

pub fn send_chunks(&self, chunks: impl IntoIterator<Item = Chunk>)

Records multiple Chunks.

This will not inject log_tick and log_time timeline columns into the chunk, for that use Self::log_chunks.

Source

pub fn set_sink(&self, new_sink: Box<dyn LogSink>)

Swaps the underlying sink for a new one.

This guarantees that:

  1. all pending rows and chunks are batched, collected and sent down the current sink,
  2. the current sink is flushed if it has pending data in its buffers,
  3. the current sink’s backlog, if there’s any, is forwarded to the new sink.

When this function returns, the calling thread is guaranteed that all future record calls will end up in the new sink.

If the batcher’s configuration has not been set explicitly or by environment variables, this will change the batcher configuration to the sink’s default configuration.

§Data loss

If the current sink is in a broken state (e.g. a gRPC sink with a broken connection that cannot be repaired), all pending data in its buffers will be dropped.

Source

pub fn flush_async(&self) -> Result<(), SinkFlushError>

Initiates a flush of the pipeline and returns immediately.

This does not wait for the flush to propagate (see Self::flush_blocking). See RecordingStream docs for ordering semantics and multithreading guarantees.

This will never return SinkFlushError::Timeout.

Source

pub fn flush_blocking(&self) -> Result<(), SinkFlushError>

Flush the batching pipeline and waits for it to propagate.

The function will block until either the flush has completed successfully (Ok), an error has occurred (SinkFlushError::Failed), or the timeout is reached (SinkFlushError::Timeout).

Convenience for calling Self::flush_with_timeout with a timeout of Duration::MAX

Source

pub fn flush_with_timeout( &self, timeout: Duration, ) -> Result<(), SinkFlushError>

Flush the batching pipeline and optionally waits for it to propagate. If you don’t want a timeout you can pass in Duration::MAX.

The function will block until that timeout is reached, an error occurs, or the flush is complete. The function will only block while there is some hope of progress. For instance: if the underlying gRPC connection is disconnected (or never connected at all), then SinkFlushError::Failed is returned.

See RecordingStream docs for ordering semantics and multithreading guarantees.

Source§

impl RecordingStream

Source

pub fn set_sinks(&self, sinks: impl IntoMultiSink)

Stream data to multiple different sinks.

This is semantically the same as calling RecordingStream::set_sink, but the resulting RecordingStream will now stream data to multiple sinks at the same time.

Currently only supports GrpcSink and FileSink.

If the batcher’s configuration has not been set explicitly or by environment variables, This will take over a conservative default of the new sinks. (there’s no guarantee on when exactly the new configuration will be active)

Source

pub fn inspect_sink( &self, f: impl FnOnce(&(dyn LogSink + 'static)) + Send + 'static, )

Asynchronously calls a method that has read access to the currently active sink.

Since a recording stream’s sink is owned by a different thread there is no guarantee when the callback is going to be called. It’s advised to return as quickly as possible from the callback since as long as the callback doesn’t return, the sink will not receive any new data,

§Experimental

This is an experimental API and may change in future releases.

Source

pub fn connect_grpc(&self) -> Result<(), RecordingStreamError>

Swaps the underlying sink for a crate::log_sink::GrpcSink sink pre-configured to use the specified address.

See also Self::connect_grpc_opts if you wish to configure the connection.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

Source

pub fn connect_grpc_opts( &self, url: impl Into<String>, ) -> Result<(), RecordingStreamError>

Swaps the underlying sink for a crate::log_sink::GrpcSink sink pre-configured to use the specified address.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

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.

Source

pub fn serve_grpc( &self, server_options: ServerOptions, ) -> Result<(), RecordingStreamError>

Swaps the underlying sink for a crate::grpc_server::GrpcServerSink pre-configured to listen on rerun+http://127.0.0.1:9876/proxy.

To configure the gRPC server’s IP and port, use Self::serve_grpc_opts instead.

You can connect a viewer to it with rerun --connect.

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_options argument. Once reached, the earliest logged data will be dropped. Static data is never dropped.

Source

pub fn serve_grpc_opts( &self, bind_ip: impl AsRef<str>, port: u16, server_options: ServerOptions, ) -> Result<(), RecordingStreamError>

Swaps the underlying sink for a crate::grpc_server::GrpcServerSink pre-configured to listen on 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_options argument. Once reached, the earliest logged data will be dropped. Static data is never dropped.

Source

pub fn spawn(&self) -> Result<(), RecordingStreamError>

Spawns a new Rerun Viewer process from an executable available in PATH, then swaps the underlying sink for a crate::log_sink::GrpcSink sink pre-configured to send data to that new process.

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.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

Source

pub fn spawn_opts( &self, opts: &SpawnOptions, ) -> Result<(), RecordingStreamError>

Spawns a new Rerun Viewer process from an executable available in PATH, then swaps the underlying sink for a crate::log_sink::GrpcSink sink pre-configured to send data to that new process.

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.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

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.

Source

pub fn memory(&self) -> MemorySinkStorage

Swaps the underlying sink for a crate::sink::MemorySink sink and returns the associated MemorySinkStorage.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

Source

pub fn binary_stream(&self) -> BinaryStreamStorage

Swaps the underlying sink for a crate::sink::BinaryStreamSink sink and returns the associated BinaryStreamStorage.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

Source

pub fn save(&self, path: impl Into<PathBuf>) -> Result<(), FileSinkError>

Swaps the underlying sink for a crate::sink::FileSink at the specified path.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

Source

pub fn save_opts(&self, path: impl Into<PathBuf>) -> Result<(), FileSinkError>

Swaps the underlying sink for a crate::sink::FileSink at the specified path.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

If a blueprint was provided, it will be stored first in the file. Blueprints are currently an experimental part of the Rust SDK.

Source

pub fn stdout(&self) -> Result<(), FileSinkError>

Swaps the underlying sink for a crate::sink::FileSink pointed at 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.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

Source

pub fn stdout_opts(&self) -> Result<(), FileSinkError>

Swaps the underlying sink for a crate::sink::FileSink pointed at 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.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

If a blueprint was provided, it will be stored first in the file. Blueprints are currently an experimental part of the Rust SDK.

Source

pub fn disconnect(&self)

Swaps the underlying sink for a crate::sink::BufferedSink.

This is a convenience wrapper for Self::set_sink that upholds the same guarantees in terms of data durability and ordering. See Self::set_sink for more information.

Source

pub fn finalize_deferred_sinks(&self)

Finalize any sinks whose on-disk format only completes at shutdown (i.e. file-like sinks that write a footer at the end), while leaving streaming sinks (e.g. gRPC) intact.

For a bare deferring sink (e.g. FileSink from save()), this is equivalent to Self::disconnect: the sink is replaced with a crate::sink::BufferedSink and its Drop impl runs the writer thread to completion, which is what emits the footer.

For a crate::log_sink::MultiSink containing a mix of deferring and streaming children, only the deferring children are dropped. The streaming children remain live and the MultiSink continues to receive new messages.

For all other sinks this is a no-op.

Used by Python’s RecordingStream.__exit__ so file-backed recordings are consumable as soon as the with-block exits, without waiting for __del__ / GC.

Source

pub fn send_blueprint( &self, blueprint: Vec<LogMsg>, activation_cmd: BlueprintActivationCommand, )

Send a blueprint through this recording stream.

Source

pub fn send_blueprint_opts( &self, opts: &BlueprintOpts, ) -> Result<(), RecordingStreamError>

Send a crate::blueprint::Blueprint to configure the viewer layout.

Source§

impl RecordingStream

Source

pub fn now(&self) -> TimePoint

Returns the current time of the recording on the current calling thread.

This is the TimePoint that would be injected into data logged right now from this thread: it contains every user timeline set via Self::set_time and friends, plus the automatic log_time timeline if it is enabled (see Self::set_log_time_enabled).

Note that the automatic log_tick timeline is not included here — it is only assigned at the moment data is actually logged.

Returns an empty TimePoint if the recording is disabled.

See also:

Source

pub fn set_timepoint(&self, timepoint: impl Into<TimePoint>)

Set the current time of the recording, for the current calling thread.

Used for all subsequent logging performed from this same thread, until the next call to one of the index/time setting methods.

There is no requirement of monotonicity. You can move the time backwards if you like.

See also:

Source

pub fn set_time( &self, timeline: impl Into<TimelineName>, value: impl TryInto<TimeCell>, )

Set the current value of one of the timelines.

Used for all subsequent logging performed from this same thread, until the next call to one of the index/time setting methods.

There is no requirement of monotonicity. You can move the time backwards if you like.

Example:

rec.set_time("frame_nr", rerun::TimeCell::from_sequence(42));
rec.set_time("duration", std::time::Duration::from_millis(123));
rec.set_time("capture_time", std::time::SystemTime::now());

See also:

Source

pub fn set_time_sequence( &self, timeline: impl Into<TimelineName>, sequence: impl Into<i64>, )

Set the current time of the recording, for the current calling thread.

Short for set_time(timeline, rerun::TimeCell::from_sequence(sequence)).

Used for all subsequent logging performed from this same thread, until the next call to one of the index/time setting methods.

For example: rec.set_time_sequence("frame_nr", frame_nr). You can remove a timeline again using rec.disable_timeline("frame_nr").

There is no requirement of monotonicity. You can move the time backwards if you like.

See also:

Source

pub fn set_duration_secs( &self, timeline: impl Into<TimelineName>, secs: impl Into<f64>, )

Set the current time of the recording, for the current calling thread.

Short for set_time(timeline, std::time::Duration::from_secs_f64(secs))..

Used for all subsequent logging performed from this same thread, until the next call to one of the index/time setting methods.

For example: rec.set_duration_secs("time_since_start", time_offset). You can remove a timeline again using rec.disable_timeline("time_since_start").

There is no requirement of monotonicity. You can move the time backwards if you like.

See also:

Source

pub fn set_timestamp_secs_since_epoch( &self, timeline: impl Into<TimelineName>, secs: impl Into<f64>, )

Set a timestamp as seconds since Unix epoch (1970-01-01 00:00:00 UTC).

Short for self.set_time(timeline, rerun::TimeCell::from_timestamp_secs_since_epoch(secs)).

Used for all subsequent logging performed from this same thread, until the next call to one of the index/time setting methods.

You can remove a timeline again using rec.disable_timeline(timeline).

There is no requirement of monotonicity. You can move the time backwards if you like.

See also:

Source

pub fn set_timestamp_nanos_since_epoch( &self, timeline: impl Into<TimelineName>, nanos: impl Into<i64>, )

Set a timestamp as nanoseconds since Unix epoch (1970-01-01 00:00:00 UTC).

Short for self.set_time(timeline, rerun::TimeCell::set_timestamp_nanos_since_epoch(secs)).

Used for all subsequent logging performed from this same thread, until the next call to one of the index/time setting methods.

You can remove a timeline again using rec.disable_timeline(timeline).

There is no requirement of monotonicity. You can move the time backwards if you like.

See also:

Source

pub fn disable_timeline(&self, timeline: impl Into<TimelineName>)

Clears out the current time of the recording for the specified timeline, for the current calling thread.

For example: rec.disable_timeline("frame"), rec.disable_timeline("sim_time").

See also:

Source

pub fn reset_time(&self)

Clears out the current time of the recording, for the current calling thread.

Used for all subsequent logging performed from this same thread, until the next call to one of the index/time setting methods.

For example: rec.reset_time().

See also:

Source

pub fn log_tick_enabled(&self) -> bool

Whether the log_tick timeline is automatically injected into logged data.

Defaults to false (opt-in), overridable via the RERUN_LOG_TICK env-var. See also Self::set_log_tick_enabled.

Source

pub fn log_time_enabled(&self) -> bool

Whether the log_time timeline is automatically injected into logged data.

Defaults to true (opt-out), overridable via the RERUN_LOG_TIME env-var. See also Self::set_log_time_enabled.

Source

pub fn set_log_tick_enabled(&self, enabled: bool)

Enable or disable automatic injection of the log_tick timeline into logged data.

log_tick is a per-recording counter that increments on every logging call. It is disabled by default; this lets you turn it on (or off) at runtime, overriding the RERUN_LOG_TICK env-var.

See also Self::set_log_time_enabled.

Source

pub fn set_log_time_enabled(&self, enabled: bool)

Enable or disable automatic injection of the log_time timeline into logged data.

log_time is the wall-clock time at which data was logged. It is enabled by default; this lets you turn it off (or on) at runtime, overriding the RERUN_LOG_TIME env-var.

See also Self::set_log_tick_enabled.

Trait Implementations§

Source§

impl Clone for RecordingStream

Source§

fn clone(&self) -> RecordingStream

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RecordingStream

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Drop for RecordingStream

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .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
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> To for T
where T: ?Sized,

Source§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
Source§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.