pub struct SubscribeHandle<Sub: Send + 'static> { /* private fields */ }Expand description
A clonable handle for attaching subscribers to a running system’s threads.
Implementations§
Source§impl<Sub: Send + 'static> SubscribeHandle<Sub>
impl<Sub: Send + 'static> SubscribeHandle<Sub>
Sourcepub async fn subscribe(&self, thread_id: &ThreadId<str>, request: Sub) -> bool
pub async fn subscribe(&self, thread_id: &ThreadId<str>, request: Sub) -> bool
Attach a subscriber to a thread. The request is handed to that
thread’s ThreadObserver::on_subscribe together with a live replay
snapshot (spawning a driver for the thread if none is running).
Resolves once the subscriber is installed — its replay has been
sent and it is registered for live events — so a caller that
subscribes and then sends a message is guaranteed to observe that
message’s events. A driver that exits while requests race in hands
them back to the router, so installation is reliable; false is
returned only if the whole system was shut down.
Trait Implementations§
Auto Trait Implementations§
impl<Sub> Freeze for SubscribeHandle<Sub>
impl<Sub> RefUnwindSafe for SubscribeHandle<Sub>
impl<Sub> Send for SubscribeHandle<Sub>
impl<Sub> Sync for SubscribeHandle<Sub>
impl<Sub> Unpin for SubscribeHandle<Sub>
impl<Sub> UnsafeUnpin for SubscribeHandle<Sub>
impl<Sub> UnwindSafe for SubscribeHandle<Sub>
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