Allow subscription/notification to be cancelled by dropping the returned Subscription

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-08-23 15:54:24 -07:00
parent f4847bd38f
commit 6df80d94ad
8 changed files with 228 additions and 110 deletions

View file

@ -190,7 +190,8 @@ impl<T: Entity> Observer<T> {
let observer = cx.add_model(|cx| {
cx.observe(handle, move |_, _, _| {
let _ = notify_tx.try_send(());
});
})
.detach();
Observer(PhantomData)
});
(observer, notify_rx)