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

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

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.