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

# Function futures::executor::spawn [−] [src]

    pub fn spawn<T>(obj: T) -> Spawn<T>

Spawns a future or stream, returning it and the new task responsible for running it to completion.

This function is the termination endpoint for running futures. This method will conceptually allocate a new task to run the given object, which is normally either a `Future` or `Stream`.

This function is similar to the `thread::spawn` function but does not attempt to run code in the background. The future will not make progress until the methods on `Spawn` are called in turn.

# 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`)