Skip to main content

IObservableCollection

Trait IObservableCollection 

Source
pub trait IObservableCollection<T: Clone + PartialEq + 'static>:
    INotifyCollectionChanged
    + INotifyPropertyChanged
    + INotifyCollectionChangedSuspender {
Show 14 methods // Required methods fn count(&self) -> usize; fn get(&self, index: usize) -> T; fn set(&self, index: usize, item: T); fn insert(&self, index: usize, item: T); fn remove_at(&self, index: usize); fn clear(&self); fn to_vec(&self) -> Vec<T>; fn load(&self, items: Vec<T>); fn move_item(&self, old_index: usize, new_index: usize); // Provided methods fn add(&self, item: T) { ... } fn index_of(&self, item: &T) -> Option<usize> { ... } fn contains(&self, item: &T) -> bool { ... } fn remove(&self, item: &T) -> bool { ... } fn clone_changes(&self, changes: &ChangeSet<T>) { ... }
}
Expand description

The collection that the binding operators fill (IObservableCollection<T>): a list that notifies its changes and can hold its notifications back.

Deviation (DEVIATIONS.md, DynamicData): the collection is a shared handle, as the object of .NET is a reference, so its methods take &self; the members of IList<T> that the binding uses are part of the trait.

Required Methods§

Source

fn count(&self) -> usize

The number of items (Count).

Source

fn get(&self, index: usize) -> T

The item at index (the indexer’s getter).

Source

fn set(&self, index: usize, item: T)

Replaces the item at index (the indexer’s setter).

Source

fn insert(&self, index: usize, item: T)

Inserts an item (Insert).

Source

fn remove_at(&self, index: usize)

Removes the item at index (RemoveAt).

Source

fn clear(&self)

Removes every item (Clear).

Source

fn to_vec(&self) -> Vec<T>

A copy of the items.

Source

fn load(&self, items: Vec<T>)

Clears the collection and adds the items (Load).

Source

fn move_item(&self, old_index: usize, new_index: usize)

Moves the item at old_index to new_index (Move).

Provided Methods§

Source

fn add(&self, item: T)

Adds an item at the end (Add).

Source

fn index_of(&self, item: &T) -> Option<usize>

The index of item (IndexOf).

Source

fn contains(&self, item: &T) -> bool

Whether the collection has item (Contains).

Source

fn remove(&self, item: &T) -> bool

Removes item; false when it is not there (Remove).

Source

fn clone_changes(&self, changes: &ChangeSet<T>)

Applies the changes of a list (ListEx.Clone(IList<T>, IChangeSet<T>)): the general form, which moves items with move_item as upstream does for an ObservableCollection<T>.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§