Skip to main content

StreamGate

Trait StreamGate 

pub trait StreamGate:
    Send
    + Sync
    + 'static {
    // Required methods
    fn poll_admit(&mut self, cx: &mut Context<'_>, want: u64) -> Poll<u64>;
    fn settle(&mut self, used: u64);
}
Available on crate feature net only.
Expand description

Paces one direction of one stream.

Required Methods§

fn poll_admit(&mut self, cx: &mut Context<'_>, want: u64) -> Poll<u64>

Wait until up to want (more than zero) bytes may move; yields between one and want of them.

A pending gate arranges its own wake-up and must admit eventually: data it holds back stays unread until it does, even past a lost connection. The stream also wakes the task on its own events, such as a reset.

fn settle(&mut self, used: u64)

used of the bytes the last admission yielded moved, at most all of them.

Called once per admission, in the same poll: zero when nothing moved.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§