pub struct TrackProducer {
pub info: Track,
/* private fields */
}Expand description
A producer for a track, used to create new groups.
Fields§
§info: TrackImplementations§
Source§impl TrackProducer
impl TrackProducer
pub fn new(info: Track) -> Self
Sourcepub fn create_group(&mut self, info: Group) -> Result<GroupProducer>
pub fn create_group(&mut self, info: Group) -> Result<GroupProducer>
Create a new group with the given sequence number.
Sourcepub fn append_group(&mut self) -> Result<GroupProducer>
pub fn append_group(&mut self) -> Result<GroupProducer>
Create a new group with the next sequence number.
Sourcepub fn write_frame<B: Into<Bytes>>(&mut self, frame: B) -> Result<()>
pub fn write_frame<B: Into<Bytes>>(&mut self, frame: B) -> Result<()>
Create a group with a single frame.
Sourcepub fn finish(&mut self) -> Result<()>
pub fn finish(&mut self) -> Result<()>
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 close(&mut self) -> Result<()>
👎Deprecated: use finish() or finish_at(sequence) instead
pub fn close(&mut self) -> Result<()>
Mark the track as finished after the last appended group.
Deprecated: use Self::finish for this behavior, or
Self::finish_at to set an explicit final sequence.
Sourcepub fn finish_at(&mut self, sequence: u64) -> Result<()>
pub fn finish_at(&mut self, sequence: u64) -> Result<()>
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 consume(&self) -> TrackConsumer
pub fn consume(&self) -> TrackConsumer
Create a new consumer for the track, starting at the latest group.