pub struct SubscriptionGuard<T: SubscriptionLike>(/* private fields */);
Expand description
An RAII implementation of a “scoped subscribed” of a subscription. When this structure is dropped (falls out of scope), the subscription will be unsubscribed.
Implements the [must_use]( https://doc.rust-lang.org/reference/attributes/diagnostics.html #the-must_use-attribute) attribute
If you want to drop it immediately, wrap it in its own scope
Implementations§
Source§impl<T: SubscriptionLike> SubscriptionGuard<T>
impl<T: SubscriptionLike> SubscriptionGuard<T>
Sourcepub fn new(subscription: T) -> SubscriptionGuard<T>
pub fn new(subscription: T) -> SubscriptionGuard<T>
Wraps an existing subscription with a guard to enable RAII behavior for it.
Trait Implementations§
Source§impl<T: Debug + SubscriptionLike> Debug for SubscriptionGuard<T>
impl<T: Debug + SubscriptionLike> Debug for SubscriptionGuard<T>
Source§impl<T: SubscriptionLike> Drop for SubscriptionGuard<T>
impl<T: SubscriptionLike> Drop for SubscriptionGuard<T>
Auto Trait Implementations§
impl<T> Freeze for SubscriptionGuard<T>where
T: Freeze,
impl<T> RefUnwindSafe for SubscriptionGuard<T>where
T: RefUnwindSafe,
impl<T> Send for SubscriptionGuard<T>where
T: Send,
impl<T> Sync for SubscriptionGuard<T>where
T: Sync,
impl<T> Unpin for SubscriptionGuard<T>where
T: Unpin,
impl<T> UnwindSafe for SubscriptionGuard<T>where
T: UnwindSafe,
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