ObservableCollection
struct · ferroui-system · v0.5.0
struct ObservableCollection<T>
A list that notifies its changes (ObservableCollection<T>): a shared handle, as the object
of .NET is a reference. Each change raises PropertyChanged for Count and Item[] as it
applies, then CollectionChanged, in .NET's order.
Members
newfrom_itemsptr_eqadd_collection_changedremove_collection_changedcountis_emptygetitemsto_veccontainsindex_ofaddinsertsetremove_atremovemove_itemclearitems_mut_silentset_notifications_suspendednotifications_suspendedcheck_reentrancyon_property_changedon_count_property_changedon_indexer_property_changedon_collection_reseton_collection_changed
new
fn new() -> Self
An empty collection.
from_items
fn from_items(items: Vec<T>) -> Self
A collection of the items (ObservableCollection(IEnumerable<T>)).
ptr_eq
fn ptr_eq(self: &Self, other: &Self) -> bool
Whether self and other are the same collection.
add_collection_changed
fn add_collection_changed(self: &Self, handler: Rc<CollectionChangedHandler<T>>) -> u64
Adds a handler of the typed change notifications; returns the token that removes it
(CollectionChanged +=).
remove_collection_changed
fn remove_collection_changed(self: &Self, token: u64) -> bool
Removes a handler (CollectionChanged -=).
count
fn count(self: &Self) -> usize
The number of items (Count).
is_empty
fn is_empty(self: &Self) -> bool
get
fn get(self: &Self, index: usize) -> T
The item at index (the indexer's getter).
Panics
When index is out of range (ArgumentOutOfRangeException).
items
fn items(self: &Self) -> Ref<'_, Vec<T>>
The items, borrowed.
to_vec
fn to_vec(self: &Self) -> Vec<T>
A copy of the items.
contains
fn contains(self: &Self, item: &T) -> bool
Whether the collection has item (Contains).
index_of
fn index_of(self: &Self, item: &T) -> Option<usize>
The index of item (IndexOf).
add
fn add(self: &Self, item: T)
Adds an item at the end (Add).
insert
fn insert(self: &Self, index: usize, item: T)
Inserts an item (InsertItem).
set
fn set(self: &Self, index: usize, item: T)
Replaces the item at index (the indexer's setter, SetItem).
remove_at
fn remove_at(self: &Self, index: usize)
Removes the item at index (RemoveItem).
remove
fn remove(self: &Self, item: &T) -> bool
Removes item; false when it is not there (Remove).
move_item
fn move_item(self: &Self, old_index: usize, new_index: usize)
Moves the item at old_index to new_index (Move, MoveItem).
clear
fn clear(self: &Self)
Removes every item (ClearItems): a reset.
items_mut_silent
fn items_mut_silent(self: &Self) -> RefMut<'_, Vec<T>>
The items to change without notifications (the protected Items of Collection<T>), for
a collection that raises its own notifications afterwards.
set_notifications_suspended
fn set_notifications_suspended(self: &Self, suspended: bool)
Holds back the notifications until false (the overrides of OnCollectionChanged and
OnPropertyChanged of a collection that suspends them).
notifications_suspended
fn notifications_suspended(self: &Self) -> bool
check_reentrancy
fn check_reentrancy(self: &Self)
Panics on a change made by a handler of a notification while more than one handler listens
(CheckReentrancy, InvalidOperationException).
on_property_changed
fn on_property_changed(self: &Self, name: &str)
Raises PropertyChanged for name (OnPropertyChanged).
on_count_property_changed
fn on_count_property_changed(self: &Self)
OnCountPropertyChanged.
on_indexer_property_changed
fn on_indexer_property_changed(self: &Self)
OnIndexerPropertyChanged.
on_collection_reset
fn on_collection_reset(self: &Self)
A reset (OnCollectionReset).
on_collection_changed
fn on_collection_changed(self: &Self, action: NotifyCollectionChangedAction, new_items: &[T], old_items: &[T], new_starting_index: i32, old_starting_index: i32)
Raises CollectionChanged (OnCollectionChanged), with the typed and the untyped
handlers, blocking re-entrant changes meanwhile (BlockReentrancy).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedCloneDefaultPartialEqINotifyCollectionChangedINotifyPropertyChanged
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.