Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Executor

Simple dependency-free runtime intended for tests, toy programs and demonstrations. Performance is not a main concern and you should probably use other executors like tokio.

To use this functionality, it is necessary to activate the executor feature.

Example

//! The `executor` feature allows the execution of asynchronous operations

extern crate wtx;
extern crate wtx_instances;

#[wtx::main]
async fn main() {
  println!("Hello from program!");
}

#[wtx::test]
async fn test_with_runtime(runtime: &wtx::executor::Runtime) {
  runtime
    .spawn_threaded(async move {
      println!("Hello from test!");
    })
    .unwrap();
}