pub struct Recording<S> { /* private fields */ }Expand description
A thread-safe recording of stream items with optional capacity limits.
Recording stores items with their timing information and can be shared across threads.
It supports bounded or unbounded storage.
Implementations§
Source§impl<S> Recording<S>
impl<S> Recording<S>
Sourcepub fn from_items(items: impl IntoIterator<Item = RecordedItem<S>>) -> Self
pub fn from_items(items: impl IntoIterator<Item = RecordedItem<S>>) -> Self
Creates a recording from a sequence of recorded items.
Sourcepub fn from_raw_items(items: impl IntoIterator<Item = S>) -> Self
pub fn from_raw_items(items: impl IntoIterator<Item = S>) -> Self
Creates a recording from a sequence of items.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a recording that keeps only the last capacity items.
Older items are dropped as new ones arrive.
Source§impl<S: Clone> Recording<S>
impl<S: Clone> Recording<S>
Sourcepub fn replay(&self) -> impl Stream<Item = S>
pub fn replay(&self) -> impl Stream<Item = S>
Replays items with original timing delays between them.
Sourcepub fn replay_from(&self, start_seq: u64) -> impl Stream<Item = S>
pub fn replay_from(&self, start_seq: u64) -> impl Stream<Item = S>
Replays items starting from sequence number start_seq.
Timing between replayed items is preserved.
Sourcepub fn replay_since(&self, since: SystemTime) -> impl Stream<Item = S>
pub fn replay_since(&self, since: SystemTime) -> impl Stream<Item = S>
Replays items recorded after since.
Timing between replayed items is preserved.
Sourcepub fn replay_range(&self, start: u64, end: u64) -> impl Stream<Item = S>
pub fn replay_range(&self, start: u64, end: u64) -> impl Stream<Item = S>
Replays items within the sequence range [start, end] (inclusive).
Timing between replayed items is preserved.
Sourcepub fn replay_with_speed(&self, speed: Speed) -> impl Stream<Item = S>
pub fn replay_with_speed(&self, speed: Speed) -> impl Stream<Item = S>
Replays with adjusted timing. Speed of 2.0 is twice as fast, 0.5 is half the speed. Relative timing between replayed items is preserved.
Sourcepub fn replay_immediate(&self) -> impl Stream<Item = S>
pub fn replay_immediate(&self) -> impl Stream<Item = S>
Replays items immediately without any delays. Useful for tests that don’t care about timing.