pub struct EventBus { /* private fields */ }Expand description
Dynamic Event Bus for Cordis multi-agent messaging and plugin hooks.
Implementations§
Source§impl EventBus
impl EventBus
pub fn new() -> Self
Sourcepub fn subscribe<F>(
&self,
topic: &str,
handler: F,
) -> Box<dyn FnOnce() -> Result<(), String> + Send + 'static>
pub fn subscribe<F>( &self, topic: &str, handler: F, ) -> Box<dyn FnOnce() -> Result<(), String> + Send + 'static>
Registers an event handler for a topic. Returns a cleanup closure (RAII disposable) that unregisters this subscription.
Sourcepub fn subscribe_with_did<F>(
&self,
topic: &str,
allowed_did: Option<String>,
handler: F,
) -> Box<dyn FnOnce() -> Result<(), String> + Send + 'static>
pub fn subscribe_with_did<F>( &self, topic: &str, allowed_did: Option<String>, handler: F, ) -> Box<dyn FnOnce() -> Result<(), String> + Send + 'static>
Registers an event handler restricted to a specific DID. Returns a cleanup closure (RAII disposable) that unregisters this subscription.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EventBus
impl !UnwindSafe for EventBus
impl Forget for EventBus
impl Freeze for EventBus
impl Move for EventBus
impl Send for EventBus
impl Sync for EventBus
impl Unpin for EventBus
impl UnsafeUnpin for EventBus
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