ChangeAwareList
struct · ferroui-dynamic-data · v0.5.0
struct ChangeAwareList<T>
A list that records its changes until they are captured (ChangeAwareList<T>), batching
consecutive insertions and removals into ranges as upstream does.
Members
newwith_capacityfrom_itemsfrom_listcountis_emptyitemsgetsetaddcapture_changesclearcontainsindex_ofindex_of_withinsertmove_itemrefresh_withrefreshrefresh_atremoveremove_atadd_rangeremove_range
new
fn new() -> Self
An empty list (ChangeAwareList(int capacity = -1)).
with_capacity
fn with_capacity(capacity: usize) -> Self
An empty list with room for capacity items.
from_items
fn from_items(items: Vec<T>) -> Self
A list of the items, whose first change adds them (ChangeAwareList(IEnumerable<T>)).
from_list
fn from_list(list: &ChangeAwareList<T>, copy_changes: bool) -> Self
A copy of list, with its changes or without (ChangeAwareList(ChangeAwareList<T>, bool)).
count
fn count(self: &Self) -> usize
The number of items (Count).
is_empty
fn is_empty(self: &Self) -> bool
items
fn items(self: &Self) -> &[T]
The items.
get
fn get(self: &Self, index: usize) -> &T
The item at index (the indexer's getter).
set
fn set(self: &mut Self, index: usize, item: T)
Replaces the item at index (the indexer's setter, SetItem).
add
fn add(self: &mut Self, item: T)
Adds an item at the end (Add).
capture_changes
fn capture_changes(self: &mut Self) -> ChangeSet<T>
The changes since the last capture, and a clean slate (CaptureChanges): removals that
emptied the list are reported as one Clear.
clear
fn clear(self: &mut Self)
Removes every item (Clear).
contains
fn contains(self: &Self, item: &T) -> bool
Whether the list has item (Contains).
index_of
fn index_of(self: &Self, item: &T) -> Option<usize>
The index of item (IndexOf).
index_of_with
fn index_of_with(self: &Self, item: &T, comparer: &dyn Fn(&T, &T) -> bool) -> Option<usize>
The index of item by comparer (IndexOf(T, IEqualityComparer<T>)).
insert
fn insert(self: &mut Self, index: usize, item: T)
Inserts an item (Insert).
Panics
When index is beyond the end (ArgumentException).
move_item
fn move_item(self: &mut Self, item: &T, destination: usize)
Moves item to destination (Move(T, int)).
refresh_with
fn refresh_with(self: &mut Self, item: T, index: usize)
Replaces the item at index with item and reports a refresh (Refresh(T, int)).
refresh
fn refresh(self: &mut Self, item: &T) -> bool
Reports a refresh of item; false when it is not in the list (Refresh(T)).
refresh_at
fn refresh_at(self: &mut Self, index: usize)
Reports a refresh of the item at index (RefreshAt).
remove
fn remove(self: &mut Self, item: &T) -> bool
Removes item; false when it is not in the list (Remove(T)).
remove_at
fn remove_at(self: &mut Self, index: usize)
Removes the item at index (RemoveAt).
add_range
fn add_range(self: &mut Self, items: Vec<T>)
Adds the items at the end (AddRange).
remove_range
fn remove_range(self: &mut Self, index: usize, count: usize)
Removes count items from index (RemoveRange).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyDefaultIExtendedList<T>IList<T>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.