mill-io
Core reactor-based event loop built on top of mio, providing efficient non-blocking I/O management without async runtimes.
Features
- Runtime-agnostic: No dependency on Tokio or other async runtimes
- Cross-platform: Leverages mio's polling abstraction (epoll, kqueue, IOCP)
- Thread pool integration: Configurable worker threads for handling I/O events
- Compute pool: Dedicated priority-based thread pool for CPU-intensive tasks
- Object pooling: Reduces allocation overhead for frequent operations
- Clean API: Simple registration and handler interface
Installation
[]
= "2.0.1"
Quick Start
use ;
use ;
;
Configuration
Default Configuration
use EventLoop;
// Uses CPU cores for workers, 1024 event capacity, 150ms timeout
let event_loop = default;
Custom Configuration
use EventLoop;
let event_loop = new?;
Compute Thread Pool
Mill-IO includes a dedicated thread pool for CPU-intensive operations, keeping the I/O event loop responsive.
use ;
let event_loop = default;
// Spawn with default (Normal) priority
event_loop.spawn_compute;
// Spawn with specific priority
event_loop.spawn_compute_with_priority;
Task Priorities
TaskPriority::Critical- Urgent tasks, processed firstTaskPriority::High- Important tasksTaskPriority::Normal- Default priorityTaskPriority::Low- Background tasks
Monitoring Metrics
let metrics = event_loop.get_compute_metrics;
println!;
println!;
println!;
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.