pub struct Chunks<'a> { /* private fields */ }Expand description
Chunks returned from RecvStream::read().
§Note: Finalization Needed
Bytes read from the stream are not released from the congestion window until
either Self::finalize() is called, or this type is dropped.
It is recommended that you call Self::finalize() because it returns a flag
telling you whether reading from the stream has resulted in the need to transmit a packet.
If this type is leaked, the stream will remain blocked on the remote peer until another read from the stream is done.
Implementations§
Source§impl<'a> Chunks<'a>
impl<'a> Chunks<'a>
Sourcepub fn next(&mut self, max_length: usize) -> Result<Option<Chunk>, ReadError>
pub fn next(&mut self, max_length: usize) -> Result<Option<Chunk>, ReadError>
Next
Should call finalize() when done calling this.
Sourcepub fn finalize(self) -> ShouldTransmit
pub fn finalize(self) -> ShouldTransmit
Mark the read data as consumed from the stream.
The number of read bytes will be released from the congestion window, allowing the remote peer to send more data if it was previously blocked.
If ShouldTransmit::should_transmit() returns true,
a packet needs to be sent to the peer informing them that the stream is unblocked.
This means that you should call Connection::poll_transmit()
and send the returned packet as soon as is reasonable, to unblock the remote peer.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Chunks<'a>
impl<'a> RefUnwindSafe for Chunks<'a>
impl<'a> Send for Chunks<'a>
impl<'a> Sync for Chunks<'a>
impl<'a> Unpin for Chunks<'a>
impl<'a> !UnwindSafe for Chunks<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more