pub struct Stream<T> { /* private fields */ }Expand description
Implementations§
Source§impl<T: Serialize> Stream<T>
impl<T: Serialize> Stream<T>
Sourcepub fn consume(&self) -> Subscriber
pub fn consume(&self) -> Subscriber
Create a subscriber for the underlying track.
Still hands one back once a failed write has ended the log: the subscriber surfaces the abort on its first read.
Sourcepub fn append(&mut self, value: &T, timestamp: Timestamp) -> Result<()>
pub fn append(&mut self, value: &T, timestamp: Timestamp) -> Result<()>
Append one record to the log at timestamp on the broadcast clock.
A record that cannot be written ends the track (see moq_json::stream::Producer::append)
and retires the catalog entry with it. A record refused with
[moq_net::Error::FrameTooLarge], [moq_net::Error::GroupTooLarge], or
[moq_net::Error::TimestampMismatch] leaves both intact, since nothing was written. A catalog
error publishing the measured bitrate is returned after the record was written, so the track
stays open and a retry would duplicate it.
Sourcepub fn finish(self) -> Result<()>
pub fn finish(self) -> Result<()>
Finish the track and retire its catalog entry.
Consumes the handle, so a write after finishing cannot be expressed. Leaving the entry advertising a closed track would only mislead a consumer that subscribed afterwards, so dropping the handle without finishing retires the entry too.