fn run<F>(future: F, threads: Threads)
    where F: Future<Item = (), Error = Error> + Send + 'static
{
    if threads == Threads::N(1) {
        let mut runtime = runtime::current_thread::Runtime::new().expect("Failed to create runtime");
        runtime.block_on(future).expect("Execution was terminated with error");
    } else {
        let mut builder = runtime::Builder::new();
        builder.name_prefix("tox-node-");
        match threads {
            Threads::N(n) => { builder.core_threads(n as usize); },
            Threads::Auto => { }, // builder will detect number of cores automatically
        }
        let mut runtime = builder
            .build()
            .expect("Failed to create runtime");
        runtime.block_on(future).expect("Execution was terminated with error");
    };
}
/// Run a future with the runtime specified by config.
Run a future with the runtime specified by config.
Run a future with the runtime specified by config .
fn run<F>(future: F, threads: Threads)
    where F: Future<Item = (), Error = Error> + Send + 'static
{
    if threads == Threads::N(1) {
        let mut runtime = runtime::current_thread::Runtime::new().expect("Failed to create runtime");
        runtime.block_on(future).expect("Execution was terminated with error");
    } else {
        let mut builder = runtime::Builder::new();
        builder.name_prefix("tox-node-");
        match threads {
            Threads::N(n) => { builder.core_threads(n as usize); },
            Threads::Auto => { }, // builder will detect number of cores automatically
        }
        let mut runtime = builder
            .build()
            .expect("Failed to create runtime");
        runtime.block_on(future).expect("Execution was terminated with error");
    };
}
fn run < F > ( future : F , threads : Threads ) where F : Future < Item = ( ) , Error = Error > + Send + ' static { if threads == Threads :: N ( 1 ) { let mut runtime = runtime :: current_thread :: Runtime :: new ( ) . expect ( " " ) ; runtime . block_on ( future ) . expect ( " " ) ; } else { let mut builder = runtime :: Builder :: new ( ) ; builder . name_prefix ( " " ) ; match threads { Threads :: N ( n ) => { builder . core_threads ( n as usize ) ; } , Threads :: Auto => { } , // builder will detect number of cores automatically } let mut runtime = builder . build ( ) . expect ( " " ) ; runtime . block_on ( future ) . expect ( " " ) ; } ; }
Run a future with the runtime specified by config.
Run a future with the runtime specified by config .
future
F
threads
Threads
future
F
threads
Threads