Function salvo::run_with_threads[][src]

pub fn run_with_threads<F>(future: F, threads: usize) where
    F: Future
Expand description

If you don’t want to include tokio in your project directly, you can use this function to run server.

use salvo_core::prelude::*;
#[fn_handler]
async fn hello_world() -> &'static str {
    "Hello World"
}
fn main() {
   let service = Router::new().get(hello_world);
   let server = Server::new(TcpListener::bind(([0, 0, 0, 0], 7878))).serve(router).await;
   salvo_core::run_with_threads(server, 8);
}