pub trait Collection: 'static {
type Item: 'static;
type Guard: WatcherGuard;
// Required methods
fn get(&self, index: usize) -> Option<Self::Item>;
fn len(&self) -> usize;
fn watch(
&self,
range: impl RangeBounds<usize>,
watcher: impl for<'a> Fn(Context<&'a [Self::Item]>) + 'static,
) -> Self::Guard;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
A trait for collections that can be observed for changes.
This trait provides a common interface for collections that support reactive programming patterns through watchers.
Required Associated Types§
Sourcetype Guard: WatcherGuard
type Guard: WatcherGuard
The type of guard returned when registering a watcher.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.