pub struct TrackConsumer { /* private fields */ }Expand description
A consumer for a track, used to read groups.
Implementations§
Source§impl TrackConsumer
impl TrackConsumer
Sourcepub fn poll_recv_group(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Option<GroupConsumer>>>
pub fn poll_recv_group( &mut self, waiter: &Waiter, ) -> Poll<Result<Option<GroupConsumer>>>
Poll for the next group in arrival order, without blocking.
Returns every group exactly once in the order it landed on the wire — which may be
out of sequence due to network reordering or loss. Use Self::poll_next_group if
you only want groups whose sequence number is higher than any previously returned.
Returns Poll::Ready(Ok(Some(group))) when a group is available,
Poll::Ready(Ok(None)) when the track is finished,
Poll::Ready(Err(e)) when the track has been aborted, or
Poll::Pending when no group is available yet.
Sourcepub async fn recv_group(&mut self) -> Result<Option<GroupConsumer>>
pub async fn recv_group(&mut self) -> Result<Option<GroupConsumer>>
Receive the next group in arrival order.
Every group is returned exactly once, in the order it landed on the wire — which may
be out of sequence due to network reordering or loss. Use Self::next_group if you
only want groups whose sequence number is higher than any previously returned.
Sourcepub fn poll_next_group(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Option<GroupConsumer>>>
pub fn poll_next_group( &mut self, waiter: &Waiter, ) -> Poll<Result<Option<GroupConsumer>>>
Poll for the next group with a higher sequence number than any previously returned.
Late arrivals (sequence at or below the last returned) are silently skipped, so this
produces a monotonically increasing sequence at the cost of dropping out-of-order
groups. Use Self::poll_recv_group to see every group in arrival order instead.
Sourcepub async fn next_group(&mut self) -> Result<Option<GroupConsumer>>
pub async fn next_group(&mut self) -> Result<Option<GroupConsumer>>
Return the next group with a higher sequence number than any previously returned.
Late arrivals (sequence at or below the last returned) are silently skipped, so this
produces a monotonically increasing sequence at the cost of dropping out-of-order
groups. Use Self::recv_group to see every group in arrival order instead.
Sourcepub fn poll_read_frame(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Option<Bytes>>>
pub fn poll_read_frame( &mut self, waiter: &Waiter, ) -> Poll<Result<Option<Bytes>>>
A helper that calls Self::poll_next_group and returns its first frame,
skipping the rest of the group. Intended for single-frame groups (see
TrackProducer::write_frame).
Sourcepub async fn read_frame(&mut self) -> Result<Option<Bytes>>
pub async fn read_frame(&mut self) -> Result<Option<Bytes>>
Read a single full frame from the next group in sequence order.
See Self::poll_read_frame for semantics.
Sourcepub fn poll_get_group(
&self,
waiter: &Waiter,
sequence: u64,
) -> Poll<Result<Option<GroupConsumer>>>
pub fn poll_get_group( &self, waiter: &Waiter, sequence: u64, ) -> Poll<Result<Option<GroupConsumer>>>
Poll for the group with the given sequence, without blocking.
Sourcepub async fn get_group(&self, sequence: u64) -> Result<Option<GroupConsumer>>
pub async fn get_group(&self, sequence: u64) -> Result<Option<GroupConsumer>>
Wait until the group with the given sequence becomes available.
Resolves to Some(GroupConsumer) once the group is in the cache.
Resolves to None only when sequence is at or past the track’s
final_sequence (set by finish() / finish_at()), since such a
group can never be produced. Sequences below final_sequence still
wait, since older groups may still arrive out of order.
Sourcepub fn poll_closed(&self, waiter: &Waiter) -> Poll<Result<()>>
pub fn poll_closed(&self, waiter: &Waiter) -> Poll<Result<()>>
Poll for track closure, without blocking.
Sourcepub async fn closed(&self) -> Result<()>
pub async fn closed(&self) -> Result<()>
Block until the track is closed.
Returns Ok() is the track was cleanly finished.
Sourcepub fn is_clone(&self, other: &Self) -> bool
pub fn is_clone(&self, other: &Self) -> bool
Whether other was cloned from this consumer (shares the same underlying state).
Sourcepub fn poll_finished(&mut self, waiter: &Waiter) -> Poll<Result<u64>>
pub fn poll_finished(&mut self, waiter: &Waiter) -> Poll<Result<u64>>
Poll for the total number of groups in the track.
Trait Implementations§
Source§impl Clone for TrackConsumer
impl Clone for TrackConsumer
Source§fn clone(&self) -> TrackConsumer
fn clone(&self) -> TrackConsumer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more