pub struct ChangeAwareList<T> { /* private fields */ }Expand description
A list that records its changes until they are captured (ChangeAwareList<T>), batching
consecutive insertions and removals into ranges as upstream does.
Implementations§
Source§impl<T: Clone + PartialEq> ChangeAwareList<T>
impl<T: Clone + PartialEq> ChangeAwareList<T>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
An empty list with room for capacity items.
Sourcepub fn from_items(items: Vec<T>) -> Self
pub fn from_items(items: Vec<T>) -> Self
A list of the items, whose first change adds them (ChangeAwareList(IEnumerable<T>)).
Sourcepub fn from_list(list: &ChangeAwareList<T>, copy_changes: bool) -> Self
pub fn from_list(list: &ChangeAwareList<T>, copy_changes: bool) -> Self
A copy of list, with its changes or without (ChangeAwareList(ChangeAwareList<T>, bool)).
pub fn is_empty(&self) -> bool
Sourcepub fn set(&mut self, index: usize, item: T)
pub fn set(&mut self, index: usize, item: T)
Replaces the item at index (the indexer’s setter, SetItem).
Sourcepub fn capture_changes(&mut self) -> ChangeSet<T>
pub fn capture_changes(&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.
Sourcepub fn index_of_with(
&self,
item: &T,
comparer: &dyn Fn(&T, &T) -> bool,
) -> Option<usize>
pub fn index_of_with( &self, item: &T, comparer: &dyn Fn(&T, &T) -> bool, ) -> Option<usize>
The index of item by comparer (IndexOf(T, IEqualityComparer<T>)).
Sourcepub fn move_item(&mut self, item: &T, destination: usize)
pub fn move_item(&mut self, item: &T, destination: usize)
Moves item to destination (Move(T, int)).
Sourcepub fn refresh_with(&mut self, item: T, index: usize)
pub fn refresh_with(&mut self, item: T, index: usize)
Replaces the item at index with item and reports a refresh (Refresh(T, int)).
Sourcepub fn refresh(&mut self, item: &T) -> bool
pub fn refresh(&mut self, item: &T) -> bool
Reports a refresh of item; false when it is not in the list (Refresh(T)).
Sourcepub fn refresh_at(&mut self, index: usize)
pub fn refresh_at(&mut self, index: usize)
Reports a refresh of the item at index (RefreshAt).
Trait Implementations§
Source§impl<T: Clone + PartialEq> IExtendedList<T> for ChangeAwareList<T>
impl<T: Clone + PartialEq> IExtendedList<T> for ChangeAwareList<T>
Source§fn insert_range(&mut self, items: Vec<T>, index: usize)
fn insert_range(&mut self, items: Vec<T>, index: usize)
index (InsertRange).Source§fn move_index(&mut self, original: usize, destination: usize)
fn move_index(&mut self, original: usize, destination: usize)
original to destination (Move(int, int)).Source§impl<T: Clone + PartialEq> IList<T> for ChangeAwareList<T>
impl<T: Clone + PartialEq> IList<T> for ChangeAwareList<T>
Source§fn remove(&mut self, item: &T) -> bool
fn remove(&mut self, item: &T) -> bool
item; false when it is not in the list (Remove).Source§fn add_range(&mut self, items: Vec<T>)
fn add_range(&mut self, items: Vec<T>)
ListEx.AddRange): one by one unless the list adds ranges.Source§fn add_or_insert_range(&mut self, items: Vec<T>, index: Option<usize>)
fn add_or_insert_range(&mut self, items: Vec<T>, index: Option<usize>)
index, or adds them without an index (ListEx.AddOrInsertRange): in
reverse order at the index unless the list inserts ranges, as upstream does.Source§fn remove_range(&mut self, index: usize, count: usize)
fn remove_range(&mut self, index: usize, count: usize)
Source§fn supports_ranges(&self) -> bool
fn supports_ranges(&self) -> bool
List<T> or IExtendedList<T>).Source§fn move_item(&mut self, original: usize, destination: usize)
fn move_item(&mut self, original: usize, destination: usize)
original to destination (the Moved case of ListEx.Clone).Source§fn refresh_at(&mut self, index: usize, _item: T)
fn refresh_at(&mut self, index: usize, _item: T)
index (the Refresh case of ListEx.Clone): the item is
removed and inserted again unless the list reports refreshes.