Trait yrs::types::DeepObservable
source · [−]pub trait DeepObservable {
fn observe_deep<F>(&mut self, f: F) -> Subscription<Events>
where
F: Fn(&Transaction, &Events) + 'static;
fn unobserve_deep(&mut self, subscription_id: SubscriptionId);
}
Expand description
Trait implemented by all Y-types, allowing for observing events which are emitted by nested types.
Required Methods
fn observe_deep<F>(&mut self, f: F) -> Subscription<Events> where
F: Fn(&Transaction, &Events) + 'static,
fn observe_deep<F>(&mut self, f: F) -> Subscription<Events> where
F: Fn(&Transaction, &Events) + 'static,
Subscribe a callback f
for all events emitted by this and nested collaborative types.
Callback is accepting transaction which triggered that event and event itself, wrapped
within an Event structure.
This method returns a subscription, which will automatically unsubscribe current callback when dropped.
fn unobserve_deep(&mut self, subscription_id: SubscriptionId)
fn unobserve_deep(&mut self, subscription_id: SubscriptionId)
Unobserves callback identified by subscription_id
(which can be obtained by consuming
Subscription using into
cast).