napi::bindgen_prelude

Function create_custom_tokio_runtime

source
pub fn create_custom_tokio_runtime(rt: Runtime)
Expand description

Create a custom Tokio runtime used by the NAPI-RS. You can control the tokio runtime configuration by yourself.

ยงExample

use tokio::runtime::Builder;
use napi::create_custom_tokio_runtime;

#[napi::module_init]
fn init() {
   let rt = Builder::new_multi_thread().enable_all().thread_stack_size(32 * 1024 * 1024).build().unwrap();
   create_custom_tokio_runtime(rt);
}