# actix_web::actix::run - Rust
API documentation for the Rust `run` fn in crate `actix_web`.
Keywords: rust, rustlang, rust-lang, run

# [−] Function actix_web::actix::run

    pub fn run<F, R>(f: F) where
        F: FnOnce() -> R,
        R: Future<Item = (), Error = ()> + 'static,

Start the System and execute supplied future.

This function does the following:

- Creates and starts actix System with default configuration.
- Spawn the given future onto the current arbiter.
- Block the current thread until the system shuts down.

`run` functions returns when `System::current().stop()` method get called.

# Examples

    use std::time::{Duration, Instant};
    use tokio_timer::Delay;

    fn main() {
      actix::run(
          || Delay::new(Instant::now() + Duration::from_millis(100))
               .map(|_| actix::System::current().stop())
               .map_err(|_| ())
      );
    }

# Panics

This function panics if actix system is already running.

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

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)