Skip to main content

ferroui_dynamic_data/cache/
i_grouping.rs

1//! `IGrouping<TObject, TKey, TGroupKey>` (`Cache/IGrouping.cs`).
2
3/// The state of a group at one moment (`IGrouping<TObject, TKey, TGroupKey>`): the items of the
4/// change sets of `GroupWithImmutableState` and `GroupOnPropertyWithImmutableState`, which replace
5/// a group with a new state whenever its items change.
6pub trait IGrouping<T, K, G> {
7    /// The number of items (`Count`).
8    fn count(&self) -> usize;
9
10    /// The items (`Items`).
11    fn items(&self) -> Vec<T>;
12
13    /// The group key (`Key`).
14    fn key(&self) -> &G;
15
16    /// The keys of the items (`Keys`).
17    fn keys(&self) -> Vec<K>;
18
19    /// The keys with their items (`KeyValues`).
20    fn key_values(&self) -> Vec<(K, T)>;
21
22    /// The item of `key` (`Lookup`).
23    fn lookup(&self, key: &K) -> Option<T>;
24}