ferroui_dynamic_data/binding/i_observable_collection_adaptor.rs
1//! `IObservableCollectionAdaptor<TObject, TKey>` and `ISortedObservableCollectionAdaptor<TObject,
2//! TKey>` (`Binding/IObservableCollectionAdaptor.cs`, `Binding/ISortedObservableCollectionAdaptor.cs`).
3
4use super::IObservableCollection;
5use crate::cache::{ChangeSet, SortedChangeSet};
6
7/// Applies the change sets of a cache to an observable collection
8/// (`IObservableCollectionAdaptor<TObject, TKey>`).
9pub trait IObservableCollectionAdaptor<T: Clone + PartialEq + 'static, K> {
10 /// Applies `changes` to `collection` (`Adapt`).
11 fn adapt(&self, changes: &ChangeSet<T, K>, collection: &dyn IObservableCollection<T>);
12}
13
14/// Applies the sorted change sets of a cache to an observable collection
15/// (`ISortedObservableCollectionAdaptor<TObject, TKey>`).
16pub trait ISortedObservableCollectionAdaptor<T: Clone + PartialEq + 'static, K> {
17 /// Applies `changes` to `collection` (`Adapt`).
18 fn adapt(&self, changes: &SortedChangeSet<T, K>, collection: &dyn IObservableCollection<T>);
19}