pub trait Watchable<T>:
Clone
+ Gettable<T>
+ DepNode
+ Sized
+ Send
+ Sync
+ 'static {
// Required methods
fn subscribe(
&self,
callback: impl Fn(&Signal<T>) + Send + Sync + 'static,
) -> SubscriptionGuard;
fn unsubscribe(&self, id: Uuid);
fn is_complete(&self) -> bool;
fn is_error(&self) -> bool;
fn error(&self) -> Option<Arc<Error>>;
}Expand description
Core reactive cell trait - subscribe to changes.
Required Methods§
Sourcefn subscribe(
&self,
callback: impl Fn(&Signal<T>) + Send + Sync + 'static,
) -> SubscriptionGuard
fn subscribe( &self, callback: impl Fn(&Signal<T>) + Send + Sync + 'static, ) -> SubscriptionGuard
Subscribe to all signals (values, completion, errors). Returns a guard that unsubscribes when dropped.
The callback must not panic. Cell::notify walks subscribers in order and does not
isolate panics — a panicking subscriber propagates out of the set/send call that
triggered the notification and prevents later subscribers in the same fanout from
observing the signal, leaving the reactive graph in a partially-updated state. Keep
subscribers pure and fast; handle expected errors inside the callback.
Sourcefn unsubscribe(&self, id: Uuid)
fn unsubscribe(&self, id: Uuid)
Unsubscribe by ID (for internal use).
Sourcefn is_complete(&self) -> bool
fn is_complete(&self) -> bool
Returns true if this cell has completed (no more values will be emitted).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".