Expand description
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.