Trait gain::stream::Recv[][src]

pub trait Recv {
    fn recv<R>(&mut self, capacity: usize, receptor: R) -> Recv<'_, R>
Notable traits for StreamRecvFuture<'_, R>
impl<R> Future for StreamRecvFuture<'_, R> where
    R: Fn(&[u8], i32) -> usize + Unpin
type Output = Option<i32>;

    where
        R: Fn(&[u8], i32) -> usize + Unpin
; }
Expand description

Data subscriber and receiver.

Required methods

Receive data packets repeatedly. Returns a future.

The initial reception capacity determines the maximum data packet size which the first receptor invocation may receive. Subsequent reception capacity is the sum of the unused capacity (subscribed minus received) and the number returned by the receptor.

The receptor must be prepared to handle as much data as is subscribed at any given time.

The call returns once the stream is closed or the reception capacity drops to zero.

Implementors