pub struct SaTokenEventBus { /* private fields */ }Expand description
事件总线 - 管理所有监听器并分发事件
Implementations§
Source§impl SaTokenEventBus
impl SaTokenEventBus
Sourcepub fn register(&self, listener: Arc<dyn SaTokenListener>)
pub fn register(&self, listener: Arc<dyn SaTokenListener>)
注册监听器 Register a listener
Sourcepub async fn register_async(&self, listener: Arc<dyn SaTokenListener>)
pub async fn register_async(&self, listener: Arc<dyn SaTokenListener>)
异步注册监听器(为了保持 API 兼容性) Register a listener asynchronously (for API compatibility)
Sourcepub fn listener_count(&self) -> usize
pub fn listener_count(&self) -> usize
获取监听器数量 Get listener count
Sourcepub async fn publish(&self, event: SaTokenEvent)
pub async fn publish(&self, event: SaTokenEvent)
发布事件 Publish an event to all listeners
Trait Implementations§
Source§impl Clone for SaTokenEventBus
impl Clone for SaTokenEventBus
Source§fn clone(&self) -> SaTokenEventBus
fn clone(&self) -> SaTokenEventBus
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SaTokenEventBus
impl RefUnwindSafe for SaTokenEventBus
impl Send for SaTokenEventBus
impl Sync for SaTokenEventBus
impl Unpin for SaTokenEventBus
impl UnwindSafe for SaTokenEventBus
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)