pub trait Lease: Buf {
// Required methods
fn chunks(&self) -> impl Iterator<Item = &[u8]>;
fn is_fin(&self) -> bool;
fn release(self);
// Provided method
fn set_window(&mut self, window: u64) { ... }
}Expand description
Unreleased bytes borrowed from a RecvStream by poll_lease,
read as a Buf.
Bytes read keep their credit until release, which is how a frame
reaches its consumer before the whole of it has arrived. Implementations override
Buf::copy_to_bytes to hand out bytes within one chunk without copying.
Required Methods§
Provided Methods§
Sourcefn set_window(&mut self, window: u64)
fn set_window(&mut self, window: u64)
Set the stream’s window, as RecvStream::set_window does, in the same step as the
lease is handed back, by release or a drop.
The reader shrinks the window for the bytes it just read, and the credit they return may be granted from the window as the transport builds the grant. A shrink made after the hand back can lose that race, and credit granted cannot be taken back. Ignored by default, for a transport whose streams cannot set a window.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".