Releases: jamesgober/mod-events
mod-events v0.1.0-beta - The Fastest Event System in Rust
Initial beta release of mod-events - a blazing-fast, zero-overhead event dispatcher that delivers sub-microsecond performance.
What is mod-events?
A high-performance, type-safe event dispatcher library for Rust that implements the observer pattern with compile-time guarantees and runtime speeds that crush the competition.
Performance Highlights
- 262ns latency - Sub-microsecond event dispatch
- 3.8M events/sec - Millions of events per second throughput
- Zero-cost abstractions - No runtime overhead
- Thread-safe - Built for concurrent applications
- Memory efficient - <1KB overhead for typical usage
Key Features
Type-safe events - Compile-time guarantees, no runtime strings
Priority system - Control execution order of listeners
Async support - Full async/await compatibility
Middleware - Event filtering and transformation
Fire-and-forget - Ultra-fast emit() for maximum performance
Built-in metrics - Monitor dispatch counts and performance
Thread-safe - Concurrent access with minimal contention
Why mod-events?
- 10-100x faster than Redis Pub/Sub, RabbitMQ, Kafka
- 2-10x faster than Node.js EventEmitter, .NET Events
- Comparable to direct function calls but with all the benefits of an event system
- Production-ready - Comprehensive error handling and monitoring
Perfect For
- Game engines - Handle thousands of events per frame
- Real-time systems - Sub-microsecond latency requirements
- High-frequency trading - Every nanosecond counts
- Web servers - Process millions of user events
- IoT systems - Minimal resource usage
- Microservices - Fast inter-service communication
Installation
[dependencies]
mod-events = "0.1.0"
# For async support
mod-events = { version = "0.1.0", features = ["async"] }Quick Example
use mod-events::prelude::*;
#[derive(Debug, Clone)]
struct UserRegistered {
user_id: u64,
email: String,
}
impl Event for UserRegistered {
fn as_any(&self) -> &dyn std::any::Any {
self
}
}
let dispatcher = EventDispatcher::new();
// Subscribe to events
dispatcher.on(|event: &UserRegistered| {
println!("Welcome user {}!", event.user_id);
});
// Dispatch events (262ns latency!)
dispatcher.emit(UserRegistered {
user_id: 123,
email: "alice@example.com".to_string(),
});Beta Status
This is a beta release - the API is stable but we're gathering feedback before 1.0.
What's stable:
- Core event dispatching
- Type system and traits
- Performance characteristics
- Thread safety
What might change:
- Minor API refinements based on feedback
- Additional convenience methods
- Documentation improvements
Documentation
- Quick Start: Get running in 5 minutes
- API Reference: Complete method documentation
- Examples: Real-world usage patterns
- Performance Guide: Optimization tips and benchmarks
- Migration Guide: Switch from other event systems
Feedback Welcome
This beta release is your chance to influence the 1.0 API! Please:
- Try it in your projects
- Report any issues
- Suggest API improvements
- Share performance results
- Contribute examples
Built for Performance
mod-events was designed from the ground up for maximum performance. Every design decision prioritizes speed while maintaining safety and usability.
Ready to experience the fastest event system ever built?
Note: This is a beta release. While stable and production-ready, the API may have minor changes before 1.0.