pub struct FrameConsumer { /* private fields */ }Expand description
Used to consume a frame’s worth of data, streaming as bytes arrive.
Implementations§
Source§impl FrameConsumer
impl FrameConsumer
Sourcepub fn poll_read_all(&mut self, waiter: &Waiter) -> Poll<Result<Bytes>>
pub fn poll_read_all(&mut self, waiter: &Waiter) -> Poll<Result<Bytes>>
Poll for all remaining data without blocking.
Waits until the frame is finished (written == size); then returns the
remaining bytes from read_idx to the end as a single zero-copy slice.
Sourcepub async fn read_all(&mut self) -> Result<Bytes>
pub async fn read_all(&mut self) -> Result<Bytes>
Return all of the remaining bytes, blocking until the frame is finished.
Sourcepub fn poll_read_all_chunks(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Vec<Bytes>>>
pub fn poll_read_all_chunks( &mut self, waiter: &Waiter, ) -> Poll<Result<Vec<Bytes>>>
Poll for all remaining bytes (split into a single-element vec for backwards compatibility with the previous chunk-based API).
Sourcepub fn poll_read_chunk(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Option<Bytes>>>
pub fn poll_read_chunk( &mut self, waiter: &Waiter, ) -> Poll<Result<Option<Bytes>>>
Poll for the next chunk of bytes since the last read.
Returns whatever bytes have been written since the consumer’s read_idx —
could span multiple producer writes. Returns None once the frame is
finished and all bytes have been consumed.
Sourcepub async fn read_chunk(&mut self) -> Result<Option<Bytes>>
pub async fn read_chunk(&mut self) -> Result<Option<Bytes>>
Return the next chunk of bytes since the last read.
Sourcepub fn poll_read_chunks(&mut self, waiter: &Waiter) -> Poll<Result<Vec<Bytes>>>
pub fn poll_read_chunks(&mut self, waiter: &Waiter) -> Poll<Result<Vec<Bytes>>>
Poll for the next chunk; for backwards compatibility, wraps Self::poll_read_chunk in a vec (single element if any data is available).
Sourcepub async fn read_chunks(&mut self) -> Result<Vec<Bytes>>
pub async fn read_chunks(&mut self) -> Result<Vec<Bytes>>
Read the next chunk into a vector (single element if available, empty on eof).
Trait Implementations§
Source§impl Clone for FrameConsumer
impl Clone for FrameConsumer
Source§fn clone(&self) -> FrameConsumer
fn clone(&self) -> FrameConsumer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more