1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! # tokio-events
//!
//! A modern, type-safe async event bus for Rust applications built on Tokio.
//!
//! ## Features
//!
//! - **Type-safe** event publishing and subscription
//! - **High performance** async-first design built on Tokio
//! - **Flexible** subscription management
//! - **Thread-safe** by default
//!
//! ## Quick Example
//!
//! ```rust,no_run
//! use tokio_events::{Event, EventBus};
//!
//! #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
//! struct UserRegistered {
//! user_id: u64,
//! email: String,
//! }
//!
//! impl Event for UserRegistered {
//! fn event_type() -> &'static str {
//! "UserRegistered"
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create event bus
//! let bus = EventBus::builder().build().await?;
//!
//! // Subscribe to events
//! let handle = bus.subscribe(|event: UserRegistered| async move {
//! println!("New user registered: {}", event.email);
//! }).await?;
//!
//! // Publish events
//! bus.publish(UserRegistered {
//! user_id: 123,
//! email: "user@example.com".to_string(),
//! }).await?;
//!
//! // Unsubscribe when done
//! bus.unsubscribe(handle).await?;
//!
//! Ok(())
//! }
//! ```
/// Core event system traits and types
/// Error types and result aliases
/// Event registry for type-to-subscriber mapping
/// Subscription management for event handlers
/// Event dispatcher for routing events
/// The main event bus implementation
/// Persistent storage for events
// Re-export commonly used types
pub use ;
pub use ;
pub use ;
pub use ;
pub use Event;
/// Prelude module for convenient imports
///
/// # Example
/// ```rust
/// use tokio_events::prelude::*;
/// ```