FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    new

    fn new() -> Self
    

    An empty collection.

    Source

    from_items

    fn from_items(items: Vec<T>) -> Self
    

    A collection of the items (ObservableCollection(IEnumerable<T>)).

    Source

    ptr_eq

    fn ptr_eq(self: &Self, other: &Self) -> bool
    

    Whether self and other are the same collection.

    Source

    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 +=).

    Source

    remove_collection_changed

    fn remove_collection_changed(self: &Self, token: u64) -> bool
    

    Removes a handler (CollectionChanged -=).

    Source

    count

    fn count(self: &Self) -> usize
    

    The number of items (Count).

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Source

    get

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

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

    Panics

    When index is out of range (ArgumentOutOfRangeException).

    Source

    items

    fn items(self: &Self) -> Ref<'_, Vec<T>>
    

    The items, borrowed.

    Source

    to_vec

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

    A copy of the items.

    Source

    contains

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

    Whether the collection has item (Contains).

    Source

    index_of

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

    The index of item (IndexOf).

    Source

    add

    fn add(self: &Self, item: T)
    

    Adds an item at the end (Add).

    Source

    insert

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

    Inserts an item (InsertItem).

    Source

    set

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

    Replaces the item at index (the indexer's setter, SetItem).

    Source

    remove_at

    fn remove_at(self: &Self, index: usize)
    

    Removes the item at index (RemoveItem).

    Source

    remove

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

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

    Source

    move_item

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

    Moves the item at old_index to new_index (Move, MoveItem).

    Source

    clear

    fn clear(self: &Self)
    

    Removes every item (ClearItems): a reset.

    Source

    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.

    Source

    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).

    Source

    notifications_suspended

    fn notifications_suspended(self: &Self) -> bool
    

    Source

    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).

    Source

    on_property_changed

    fn on_property_changed(self: &Self, name: &str)
    

    Raises PropertyChanged for name (OnPropertyChanged).

    Source

    on_count_property_changed

    fn on_count_property_changed(self: &Self)
    

    OnCountPropertyChanged.

    Source

    on_indexer_property_changed

    fn on_indexer_property_changed(self: &Self)
    

    OnIndexerPropertyChanged.

    Source

    on_collection_reset

    fn on_collection_reset(self: &Self)
    

    A reset (OnCollectionReset).

    Source

    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).

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.