pub struct StreamCassette { /* private fields */ }Expand description
A recorded, replayable trace of a single stream.
Holds the stream metadata, the ordered envelopes, derived timing,
the deduplicated diagnostic symbols observed, and the final StreamStats.
A cassette can be rebuilt into a live StreamValue via
replay_stream_value, serialized to
an Expr map, and validated as a golden fixture.
Implementations§
Source§impl StreamCassette
impl StreamCassette
Sourcepub fn from_stream_value(
stream: &StreamValue,
profile: TransportProfile,
) -> Result<Self>
pub fn from_stream_value( stream: &StreamValue, profile: TransportProfile, ) -> Result<Self>
Records a cassette by draining every packet from a live stream.
Pulls packets until the stream is exhausted, snapshots its final stats,
and builds the cassette from the metadata, drained items, and the given
TransportProfile.
Sourcepub fn from_items(
metadata: StreamMetadata,
items: Vec<StreamItem>,
profile: TransportProfile,
final_stats: StreamStats,
) -> Result<Self>
pub fn from_items( metadata: StreamMetadata, items: Vec<StreamItem>, profile: TransportProfile, final_stats: StreamStats, ) -> Result<Self>
Records a cassette from already-drained stream items.
Wraps each item in a sequenced StreamEnvelope under the given
TransportProfile, then delegates to
from_envelopes.
Sourcepub fn from_envelopes(
metadata: StreamMetadata,
envelopes: Vec<StreamEnvelope>,
final_stats: StreamStats,
) -> Result<Self>
pub fn from_envelopes( metadata: StreamMetadata, envelopes: Vec<StreamEnvelope>, final_stats: StreamStats, ) -> Result<Self>
Builds a cassette directly from sequenced envelopes.
Derives the timing and the deduplicated diagnostic set from the envelopes, pairing them with the supplied metadata and final stats.
Sourcepub fn metadata(&self) -> &StreamMetadata
pub fn metadata(&self) -> &StreamMetadata
Returns the metadata of the recorded stream.
Sourcepub fn envelopes(&self) -> &[StreamEnvelope]
pub fn envelopes(&self) -> &[StreamEnvelope]
Returns the recorded envelopes in sequence order.
Sourcepub fn timing(&self) -> &StreamCassetteTiming
pub fn timing(&self) -> &StreamCassetteTiming
Returns the derived timing summary for the trace.
Sourcepub fn diagnostics(&self) -> &[Symbol]
pub fn diagnostics(&self) -> &[Symbol]
Returns the deduplicated diagnostic symbols observed during recording.
Sourcepub fn final_stats(&self) -> &StreamStats
pub fn final_stats(&self) -> &StreamStats
Returns the final accumulated stats captured at end of trace.
Sourcepub fn items(&self) -> Result<Vec<StreamItem>>
pub fn items(&self) -> Result<Vec<StreamItem>>
Reconstructs the stream items from the recorded envelopes.
Each item pairs an envelope’s packet with its captured ticks, ready to feed a replay stream.
Sourcepub fn replay_stream_value(&self) -> Result<StreamValue>
pub fn replay_stream_value(&self) -> Result<StreamValue>
Rebuilds a live, pull-based StreamValue from the recorded trace.
Sourcepub fn redacted(&self) -> Result<Self>
pub fn redacted(&self) -> Result<Self>
Returns a copy with host-device names and private payloads redacted.
Redacts the metadata, every envelope, and the diagnostic symbols so the result is safe to persist as a golden fixture.
Sourcepub fn validate_golden_fixture(
&self,
path: &str,
) -> Result<StreamGoldenFixtureReport>
pub fn validate_golden_fixture( &self, path: &str, ) -> Result<StreamGoldenFixtureReport>
Validates the cassette as a golden fixture at path.
Checks the path lives under STREAM_CASSETTE_FIXTURE_ROOT with the
cassette extension, that the trace is finite, that envelope sequences
match their packet index, that each transport profile is replayable or
previewable but never realtime, and that no unredacted payload or
host-device name remains. Returns a StreamGoldenFixtureReport on
success, or an error describing the first failed invariant.
Trait Implementations§
Source§impl Clone for StreamCassette
impl Clone for StreamCassette
Source§fn clone(&self) -> StreamCassette
fn clone(&self) -> StreamCassette
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamCassette
impl Debug for StreamCassette
impl Eq for StreamCassette
Source§impl PartialEq for StreamCassette
impl PartialEq for StreamCassette
Source§fn eq(&self, other: &StreamCassette) -> bool
fn eq(&self, other: &StreamCassette) -> bool
self and other values to be equal, and is used by ==.