pub struct Producer { /* private fields */ }Expand description
Writes datagrams to a datagram track.
Clones share the track and its sequence counter. The track ends on Self::finish,
Self::abort, or the last producer dropping, which consumers see as
Error::Dropped.
Implementations§
Source§impl Producer
impl Producer
Sourcepub fn append<B: IntoBytes>(
&mut self,
timestamp: Timestamp,
payload: B,
) -> Result<u64>
pub fn append<B: IntoBytes>( &mut self, timestamp: Timestamp, payload: B, ) -> Result<u64>
Append a datagram with the next sequence number, returning that sequence.
A scale-less track has no time, so its datagram’s Timestamp::unscaled names the
sequence instead, as its key names a group. A timestamp that doesn’t match the track
is Error::TimestampMismatch. Keep payloads well under the 1200-byte minimum path
MTU: a hop drops a datagram that does not fit.
Sourcepub fn insert(&mut self, datagram: Datagram) -> Result<()>
pub fn insert(&mut self, datagram: Datagram) -> Result<()>
Insert a datagram with an explicit sequence, as a relay forwarding one does.
Self::append continues past the highest sequence inserted. Nothing checks the
sequence otherwise: datagrams are unordered, so a repeat or an older one is delivered.
Sourcepub fn consume(&self) -> Consumer
pub fn consume(&self) -> Consumer
A new consumer of the track, starting with the next datagram written.
Sourcepub fn finish(self)
pub fn finish(self)
End the track cleanly: consumers read None once they have read what is buffered.
Sourcepub fn priority(&self) -> Option<i8>
pub fn priority(&self) -> Option<i8>
The highest subscriber priority among the track’s consumers, or None when it has none.
Sourcepub fn poll_priority_changed(&mut self, waiter: &Waiter) -> Poll<Option<i8>>
pub fn poll_priority_changed(&mut self, waiter: &Waiter) -> Poll<Option<i8>>
priority once it differs from what this handle last returned:
immediately on the first call, then on each change.
Sourcepub async fn priority_changed(&mut self) -> Option<i8>
pub async fn priority_changed(&mut self) -> Option<i8>
priority once it differs from what this handle last returned:
immediately on the first call, then on each change.
Awaits poll_priority_changed.