pub struct EventChannel { /* private fields */ }Expand description
Event channel for distributing document events to handlers
Implementations§
Source§impl EventChannel
impl EventChannel
Sourcepub fn with_config(config: EventChannelConfig) -> Self
pub fn with_config(config: EventChannelConfig) -> Self
Create a new event channel with custom configuration
Sourcepub fn register_handler(
&mut self,
handler: Box<dyn EventHandler>,
) -> Result<usize>
pub fn register_handler( &mut self, handler: Box<dyn EventHandler>, ) -> Result<usize>
Register an event handler
Sourcepub fn unregister_handler(&mut self, handler_id: usize) -> Result<bool>
pub fn unregister_handler(&mut self, handler_id: usize) -> Result<bool>
Unregister an event handler by ID
Sourcepub fn dispatch(&mut self, event: DocumentEvent) -> Result<()>
pub fn dispatch(&mut self, event: DocumentEvent) -> Result<()>
Dispatch an event to all registered handlers
Sourcepub fn dispatch_batch(&mut self, events: Vec<DocumentEvent>) -> Result<()>
pub fn dispatch_batch(&mut self, events: Vec<DocumentEvent>) -> Result<()>
Dispatch multiple events in a batch
Sourcepub fn stats(&self) -> &EventStats
pub fn stats(&self) -> &EventStats
Get event statistics
Sourcepub fn clear_handlers(&mut self) -> Result<()>
pub fn clear_handlers(&mut self) -> Result<()>
Clear all event handlers
Sourcepub fn setup_async(&mut self) -> UnboundedReceiver<DocumentEvent>
Available on crate feature async only.
pub fn setup_async(&mut self) -> UnboundedReceiver<DocumentEvent>
async only.Setup async event processing (requires async feature)
Sourcepub fn dispatch_async(&mut self, event: DocumentEvent) -> Result<()>
Available on crate feature async only.
pub fn dispatch_async(&mut self, event: DocumentEvent) -> Result<()>
async only.Dispatch event asynchronously (requires async feature)
Trait Implementations§
Source§impl Debug for EventChannel
impl Debug for EventChannel
Auto Trait Implementations§
impl Freeze for EventChannel
impl !RefUnwindSafe for EventChannel
impl Send for EventChannel
impl Sync for EventChannel
impl Unpin for EventChannel
impl !UnwindSafe for EventChannel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more