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

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

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

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.

An unbounded buffer is used, which means that values will be buffered as fast as stream can produce them, without any backpressure. Therefore, if stream is an infinite stream, it can use an unbounded amount of memory, and potentially hog CPU resources. In particular, if stream is infinite and doesn't ever yield (by returning Async::NotReady from poll), it will result in an infinite loop.

Panics

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