pub struct Subscription { /* private fields */ }Expand description
RAII subscription handle. Unsubscribes from the event bus on drop.
Acquire in Mode::on_activate via ctx.events_handle() +
EventBus::subscribe_typed; store in the mode’s Guard struct so
deactivation cleanup is compiler-enforced. Modes with conditional
subscriptions (e.g. skip when no URI) use Option<Subscription>.
MO.4.c: replaces the _private:() stub; Mode::subscriptions()
removed — on_activate + Guard IS the subscription mechanism.
Implementations§
Source§impl Subscription
impl Subscription
Sourcepub fn new(bus: Arc<EventBus>, id: SubscriptionId) -> Self
pub fn new(bus: Arc<EventBus>, id: SubscriptionId) -> Self
Wrap the id returned by one of bus’s subscribe calls so that
dropping this value calls EventBus::unsubscribe on it.
Takes an owned Arc because the handle outlives the activation that
created it: it is moved into the mode’s Guard,
and the Guard is dropped whenever the mode deactivates.
Trait Implementations§
Source§impl Drop for Subscription
impl Drop for Subscription
Auto Trait Implementations§
impl Freeze for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl UnsafeUnpin for Subscription
impl UnwindSafe for Subscription
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