Key Features
- Zero-cost abstractions: No runtime overhead for event dispatch.
- Type-safe: Compile-time guarantees for event handling.
- Thread-safe: Built for concurrent applications.
- Async support: Full async/await compatibility.
- Flexible: Support for sync, async, and priority-based listeners.
- Easy to use: Simple API and intuitive methods.
- Performance: Optimized for high-throughput scenarios.
- Monitoring: Built-in metrics and middleware support.
Quick Start
Add this to your Cargo.toml
:
[]
= "0.1"
Basic Usage
use *;
// Define your event
// Create dispatcher and subscribe
let dispatcher = new;
dispatcher.on;
// Dispatch events
dispatcher.emit;
Features
Priority System
use ;
let dispatcher = new;
// High priority listener executes first
dispatcher.subscribe_with_priority;
// Normal priority listener executes second
dispatcher.on;
Async Support
// Enable with the "async" feature
dispatcher.subscribe_async;
let result = dispatcher.dispatch_async.await;
Middleware
// Add middleware for logging, filtering, etc.
dispatcher.add_middleware;
Error Handling
let result = dispatcher.dispatch;
if result.all_succeeded else
Examples
Run the examples:
Benchmarks