1use futures::future::Future;
2use retrieve::*;
3use std::io::Error as AError;
4use tonic::transport::Error as TError;
5
6#[r#mod(async_runner)]
7#[mod_pub_use(error)]
8pub fn invoke(
9 actix_future: impl Future<Output = Result<(), AError>>,
10 tonic_future: impl Future<Output = Result<(), TError>>,
11 tokio_worker_threads: usize
12) -> Result<(), ActixWebTonicError>
13{
14 log::info!("actix-web and tonic futures will be start.");
15 log::info!("(Note) Use **SIGINT(CTRL+C)** if you should stop the app.");
16
17 actix_web::rt::System::with_tokio_rt(|| {
18 tokio::runtime::Builder::new_multi_thread()
19 .enable_all()
20 .worker_threads(tokio_worker_threads)
21 .thread_name("unaf::main::tokio")
22 .build()
23 .unwrap()
24 })
25 .block_on(async_runner::async_main(actix_future, tonic_future))?;
26
27 log::info!("actix-web and tonic futures has been terminated.");
28 Ok(())
29}