compio-runtime 0.11.0

High-level runtime for compio
Documentation

compio-runtime

MIT licensed crates.io docs.rs Check Test

High-level runtime for compio.

This crate provides the async runtime (executor) that coordinates task execution with the low-level driver (proactor). It implements a thread-per-core model.

Usage

The recommended way is to use main macro with compio's macros feature, but you can also use the runtime directly by enabling the runtime feature:

cargo add compio --features runtime

Example:

use compio::runtime::Runtime;

let runtime = Runtime::new().unwrap();
runtime.block_on(async {
    // Your async code here
});

Configuration

The runtime can be configured using the RuntimeBuilder:

use compio::runtime::RuntimeBuilder;
use compio::driver::ProactorBuilder;

let mut proactor = ProactorBuilder::new();

// Configure proactor here, e.g.
proactor.capacity(1024);
    
let runtime = RuntimeBuilder::new()
    .with_proactor(proactor)
    // Configure other options here
    .build()
    .unwrap();

runtime.block_on(async {
    // Your async code here
});