Document / lockdown more of GPUI

This commit is contained in:
Mikayla 2024-01-21 14:26:45 -08:00
parent 476de329b3
commit aa57a4cfbc
No known key found for this signature in database
27 changed files with 399 additions and 75 deletions

View file

@ -147,12 +147,17 @@ where
}
}
/// A handle to a subscription created by GPUI. When dropped, the subscription
/// is cancelled and the callback will no longer be invoked.
#[must_use]
pub struct Subscription {
unsubscribe: Option<Box<dyn FnOnce() + 'static>>,
}
impl Subscription {
/// Detaches the subscription from this handle. The callback will
/// continue to be invoked until the views or models it has been
/// subscribed to are dropped
pub fn detach(mut self) {
self.unsubscribe.take();
}