[]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:

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.