# Function crossbeam::scope [−] [src]

    pub fn scope<'a, F, R>(f: F) -> R where
        F: FnOnce(&Scope<'a>) -> R,

Create a new `scope`, for deferred destructors.

Scopes, in particular, support scoped thread spawning.

# Examples

Creating and using a scope:

    crossbeam::scope(|scope| {
        scope.defer(|| println!("Exiting scope"));
        scope.spawn(|| println!("Running child thread in scope"))
    });
    // Prints messages in the reverse order written

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