pub struct AtomicBus<T> { /* private fields */ }Expand description
A bus, which can send data to a set of active subscriptions.
§Data Lifetime
All underlying data is wrapped in an Arc which will be dropped immediately after all active subscribers have dropped their respective references.
§Sync
AtomicBus is Sync, so it can be wrapped in an Arc to safely share between threads.
Implementations§
Source§impl<T> AtomicBus<T>
impl<T> AtomicBus<T>
Sourcepub fn create_sender(&self) -> AtomicSender<T>
pub fn create_sender(&self) -> AtomicSender<T>
Create a send-only structure to produce messages to this bus.
Sourcepub fn subscribe(&self) -> AtomicSubscription<T>
pub fn subscribe(&self) -> AtomicSubscription<T>
Create an atomic subscription to this bus, which is Sync and can be shared between threads.
Sourcepub fn subscribe_mut(&self) -> MutSubscription<T> ⓘ
pub fn subscribe_mut(&self) -> MutSubscription<T> ⓘ
Create a mutable subscription to this bus, which is slightly faster than the atomic variant but is not Sync.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for AtomicBus<T>
impl<T> RefUnwindSafe for AtomicBus<T>where
T: RefUnwindSafe,
impl<T> Send for AtomicBus<T>
impl<T> Sync for AtomicBus<T>
impl<T> Unpin for AtomicBus<T>
impl<T> UnwindSafe for AtomicBus<T>where
T: RefUnwindSafe,
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