# futures::sync::mpsc::spawn - Rust
API documentation for the Rust `spawn` fn in crate `futures`.
Keywords: rust, rustlang, rust-lang, spawn

# Function futures::sync::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>>,

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`.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)