pub struct TrackProducer { /* private fields */ }Expand description
A producer for a track, used to create new groups.
Implementations§
Source§impl TrackProducer
impl TrackProducer
Sourcepub fn new(info: Track) -> TrackProducer
pub fn new(info: Track) -> TrackProducer
Build a producer for the given track metadata. Prefer Track::produce.
Sourcepub fn create_group(&mut self, info: Group) -> Result<GroupProducer, Error>
pub fn create_group(&mut self, info: Group) -> Result<GroupProducer, Error>
Create a new group with the given sequence number.
Sourcepub fn append_group(&mut self) -> Result<GroupProducer, Error>
pub fn append_group(&mut self) -> Result<GroupProducer, Error>
Create a new group with the next sequence number.
Sourcepub fn write_frame<B>(&mut self, frame: B) -> Result<(), Error>
pub fn write_frame<B>(&mut self, frame: B) -> Result<(), Error>
Create a group with a single frame.
Sourcepub fn finish(&mut self) -> Result<(), Error>
pub fn finish(&mut self) -> Result<(), Error>
Mark the track as finished after the last appended group.
Sets the final sequence to one past the current max_sequence. No new groups at or above this sequence can be appended. NOTE: Old groups with lower sequence numbers can still arrive.
Sourcepub fn finish_at(&mut self, sequence: u64) -> Result<(), Error>
pub fn finish_at(&mut self, sequence: u64) -> Result<(), Error>
Mark the track as finished at an exact final sequence.
The caller must pass the current max_sequence exactly. Freezes the final boundary at one past the current max_sequence. No new groups at or above that sequence can be created. NOTE: Old groups with lower sequence numbers can still arrive.
Sourcepub fn abort(&mut self, err: Error) -> Result<(), Error>
pub fn abort(&mut self, err: Error) -> Result<(), Error>
Abort the track with the given error.
Child groups are independent and must be aborted separately if desired; existing group consumers can still finish reading any groups that were already created.
Sourcepub fn consume(&self) -> TrackConsumer
pub fn consume(&self) -> TrackConsumer
Create a new consumer for the track, starting at the beginning.
Sourcepub async fn used(&self) -> Result<(), Error>
pub async fn used(&self) -> Result<(), Error>
Block until there is at least one active consumer.
Sourcepub async fn closed(&self) -> Error
pub async fn closed(&self) -> Error
Block until the track is closed or aborted, returning the cause.
Sourcepub fn is_clone(&self, other: &TrackProducer) -> bool
pub fn is_clone(&self, other: &TrackProducer) -> bool
Return true if this is the same track.
Trait Implementations§
Source§impl Clone for TrackProducer
impl Clone for TrackProducer
Source§fn clone(&self) -> TrackProducer
fn clone(&self) -> TrackProducer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more