[][src]Function websocket::async::futures::unsync::mpsc::spawn

pub fn spawn<S, E>(
    stream: S,
    executor: &E,
    buffer: usize
) -> SpawnHandle<<S as Stream>::Item, <S as Stream>::Error> where
    E: Executor<Execute<S>>,
    S: Stream

Spawns a stream onto the instance of Executor provided, executor, returning a handle representing the remote stream.

The stream will be canceled if the SpawnHandle is dropped.

The SpawnHandle returned is a stream that is a proxy for stream itself. When stream has additional items available, then the SpawnHandle will have those same items available.

At most buffer + 1 elements will be buffered at a time. If the buffer is full, then stream will stop progressing until more space is available. This allows the SpawnHandle to exert backpressure on the stream.

Panics

This function will panic if executor is unable spawn a Future containing the entirety of the stream.