pub struct RecordingSession<W: Write + Send> { /* private fields */ }Expand description
Live recording session.
Thread-safe: multiple threads can call
record_sample concurrently.
Implementations§
Source§impl<W: Write + Send> RecordingSession<W>
impl<W: Write + Send> RecordingSession<W>
Sourcepub fn new(sink: W, opts: SessionOptions) -> Self
pub fn new(sink: W, opts: SessionOptions) -> Self
Creates a new session over sink. The header is written on
the first record_sample.
Sourcepub fn record_sample(
&self,
now_unix_ns: i64,
participant_guid: [u8; 16],
topic: &TopicKey,
sample_kind: SampleKind,
payload: Vec<u8>,
) -> Result<(), SessionError>
pub fn record_sample( &self, now_unix_ns: i64, participant_guid: [u8; 16], topic: &TopicKey, sample_kind: SampleKind, payload: Vec<u8>, ) -> Result<(), SessionError>
Writes a sample. now_unix_ns must be the current
wall-clock time in nanoseconds since the epoch.
§Errors
See SessionError.
Sourcepub fn stats(&self) -> SessionStats
pub fn stats(&self) -> SessionStats
Returns the current counters (snapshot).
Auto Trait Implementations§
impl<W> !Freeze for RecordingSession<W>
impl<W> RefUnwindSafe for RecordingSession<W>
impl<W> Send for RecordingSession<W>
impl<W> Sync for RecordingSession<W>
impl<W> Unpin for RecordingSession<W>where
W: Unpin,
impl<W> UnsafeUnpin for RecordingSession<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for RecordingSession<W>
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
Mutably borrows from an owned value. Read more