KeyValueCollection
struct · ferroui-dynamic-data · v0.5.0
struct KeyValueCollection<T, K>
The sorted pairs of a key and an item of a sorted change set (KeyValueCollection<TObject, TKey>), with the comparer that sorted them and the reason of the sort.
Deviation (DEVIATIONS.md, DynamicData): a pair is the tuple (key, item), upstream's
KeyValuePair<TKey, TObject>; .0 is Key and .1 is Value. The pairs are shared, so
cloning a collection is cheap.
Members
new
fn new(items: Vec<(K, T)>, comparer: KeyValueComparer<T, K>, sort_reason: SortReason, optimisations: SortOptimisations) -> Self
A collection of items, sorted by comparer for sort_reason
(KeyValueCollection(IReadOnlyCollection<KeyValuePair<TKey, TObject>>, IComparer, SortReason, SortOptimisations)).
empty
fn empty() -> Self
An empty collection (KeyValueCollection()): no optimisations, compared by the keys.
comparer
fn comparer(self: &Self) -> &KeyValueComparer<T, K>
The comparer of the pairs (Comparer).
count
fn count(self: &Self) -> usize
The number of pairs (Count).
optimisations
fn optimisations(self: &Self) -> SortOptimisations
The optimisations of the sort (Optimisations).
sort_reason
fn sort_reason(self: &Self) -> SortReason
The reason of the sort (SortReason).
items
fn items(self: &Self) -> &[(K, T)]
The pairs, in order.
to_vec
fn to_vec(self: &Self) -> Vec<(K, T)>
where T: Clone,
K: Clone
The pairs as a list of their own (ToList).
values
fn values(self: &Self) -> impl Iterator<Item = &T>
The items, in order (Select(kv => kv.Value)).
keys
fn keys(self: &Self) -> impl Iterator<Item = &K>
The keys, in order (Select(kv => kv.Key)).
ptr_eq
fn ptr_eq(self: &Self, other: &Self) -> bool
Whether self and other share their pairs (ReferenceEquals of upstream's collections).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyToOwnedCloneDefaultDerefIntoIteratorPartialEqDebugIKeyValueCollection<T, K>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.