[−][src]Function desync::pipe::pipe_in
pub fn pipe_in<Core, S, ProcessFn>(
desync: Arc<Desync<Core>>,
stream: S,
process: ProcessFn
) where
Core: 'static + Send,
S: 'static + Send + Stream,
S::Item: Send,
S::Error: Send,
ProcessFn: 'static + Send + FnMut(&mut Core, Result<S::Item, S::Error>),
Pipes a stream into a desync object. Whenever an item becomes available on the stream, the processing function is called asynchronously with the item that was received.
This takes a weak reference to the passed in Desync
object, so the pipe will stop if it's
the only thing referencing this object.
Piping a stream to a Desync
like this will cause it to start executing: ie, this is
similar to calling executor::spawn(stream)
, except that the stream will immediately
start draining into the Desync
object.