Skip to main content

ObservableCollectionExtended

Struct ObservableCollectionExtended 

Source
pub struct ObservableCollectionExtended<T> { /* private fields */ }
Expand description

An observable collection with ranges, loads and suspended notifications (ObservableCollectionExtended<T>), the collection that the binding operators fill.

It is a shared handle over an ObservableCollection<T> (the base class upstream), which items controls read and observe: collection is that collection. The changes made through this handle raise the notifications of the base, except those that are suspended (upstream’s overrides of OnCollectionChanged and OnPropertyChanged).

Deviation (DEVIATIONS.md, DynamicData): a subclass of .NET intercepts the notifications of every change; here the changes made through collection directly are not suspended.

Implementations§

Source§

impl<T: Clone + PartialEq + 'static> ObservableCollectionExtended<T>

Source

pub fn new() -> Self

An empty collection (ObservableCollectionExtended()).

Source

pub fn with_capacity(capacity: usize) -> Self

An empty collection that has room for capacity items (ObservableCollectionExtended(new List<T>(capacity))).

Source

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

A collection of the items (ObservableCollectionExtended(IEnumerable<T>), ObservableCollectionExtended(List<T>)).

Source

pub fn collection(&self) -> &ObservableCollection<T>

The observable collection of the items (the base class upstream).

Source

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

Whether self and other are the same collection.

Source

pub fn add_collection_changed( &self, handler: Rc<CollectionChangedHandler<T>>, ) -> u64

Adds a handler of the typed change notifications; returns the token that removes it (CollectionChanged +=).

Source

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

Removes a handler (CollectionChanged -=).

Source

pub fn count(&self) -> usize

The number of items (Count).

Source

pub fn is_empty(&self) -> bool

Source

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

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

Source

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

The items, borrowed.

Source

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

A copy of the items.

Source

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

Whether the collection has item (Contains).

Source

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

The index of item (IndexOf).

Source

pub fn add(&self, item: T)

Adds an item at the end (Add).

Source

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

Inserts an item (InsertItem).

Source

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

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

Source

pub fn remove_at(&self, index: usize)

Removes the item at index (RemoveItem).

Source

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

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

Source

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

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

Source

pub fn clear(&self)

Removes every item (ClearItems): a reset.

Source

pub fn add_range(&self, items: impl IntoIterator<Item = T>)

Adds the items at the end, one at a time (AddRange).

Source

pub fn insert_range(&self, items: impl IntoIterator<Item = T>, index: usize)

Inserts the items from index, one at a time (InsertRange).

Source

pub fn load(&self, items: impl IntoIterator<Item = T>)

Clears the collection and adds the items (Load).

Source

pub fn remove_range(&self, index: usize, count: usize)

Removes count items from index, one at a time (RemoveRange).

Source

pub fn suspend_count(&self) -> Rc<dyn IDisposable>

Holds back the notifications of Count until the handle is disposed, which raises Count once if it changed (SuspendCount).

Source

pub fn suspend_notifications(&self) -> Rc<dyn IDisposable>

Holds back the notifications of changes and of Count until the handle is disposed, which raises Count and a reset (SuspendNotifications).

Source

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

Raises PropertyChanged, unless it is Count and the count is suspended (OnPropertyChanged).

Source

pub fn on_collection_changed( &self, action: NotifyCollectionChangedAction, new_items: &[T], old_items: &[T], new_starting_index: i32, old_starting_index: i32, )

Raises CollectionChanged, unless the notifications are suspended (OnCollectionChanged).

Trait Implementations§

Source§

impl<T> Clone for ObservableCollectionExtended<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Clone + PartialEq + Debug + 'static> Debug for ObservableCollectionExtended<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Clone + PartialEq + 'static> Default for ObservableCollectionExtended<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Clone + PartialEq + 'static> From<&ObservableCollectionExtended<T>> for ReadOnlyObservableCollection<T>

Source§

fn from(collection: &ObservableCollectionExtended<T>) -> Self

The view of the collection (new ReadOnlyObservableCollection<T>(observableCollectionExtended)).

Source§

impl<T: Clone + PartialEq + 'static> IExtendedList<T> for ObservableCollectionExtended<T>

Source§

fn insert_range(&mut self, items: Vec<T>, index: usize)

Inserts the items at index (InsertRange).
Source§

fn move_index(&mut self, original: usize, destination: usize)

Moves the item at original to destination (Move(int, int)).
Source§

impl<T: Clone + PartialEq + 'static> IList<T> for ObservableCollectionExtended<T>

The collection as a list of DynamicData (IList<T>, IExtendedList<T>): what ListEx and SortAndBind apply changes to.

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(&mut self, index: usize, item: T)

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

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

Inserts an item (Insert).
Source§

fn remove_at(&mut self, index: usize)

Removes the item at index (RemoveAt).
Source§

fn clear(&mut self)

Removes every item (Clear).
Source§

fn add(&mut 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 remove(&mut self, item: &T) -> bool

Removes item; false when it is not in the list (Remove).
Source§

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

Adds the items at the end (ListEx.AddRange): one by one unless the list adds ranges.
Source§

fn add_or_insert_range(&mut self, items: Vec<T>, index: Option<usize>)

Inserts the items at 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)

Removes count items from index (ListEx.RemoveRange). Read more
Source§

fn supports_ranges(&self) -> bool

Whether the list removes ranges at once (List<T> or IExtendedList<T>).
Source§

fn move_item(&mut self, original: usize, destination: usize)

Moves the item at original to destination (the Moved case of ListEx.Clone).
Source§

fn index_of_with( &self, item: &T, comparer: &dyn Fn(&T, &T) -> bool, ) -> Option<usize>

The index of item by comparer (ListEx.IndexOf(IEnumerable, T, IEqualityComparer)).
Source§

fn refresh_at(&mut self, index: usize, item: T)

Reports a refresh of the item at index (the Refresh case of ListEx.Clone): the item is removed and inserted again unless the list reports refreshes.
Source§

impl<T> INotifyCollectionChanged for ObservableCollectionExtended<T>

Source§

fn collection_changed(&self) -> &Event<CollectionChange>

The event raised when the collection changes.
Source§

impl<T: Clone + PartialEq + 'static> INotifyCollectionChangedSuspender for ObservableCollectionExtended<T>

Source§

fn suspend_count(&self) -> Rc<dyn IDisposable>

Holds back the notifications of Count until the handle is disposed, which raises Count once if it changed (SuspendCount).
Source§

fn suspend_notifications(&self) -> Rc<dyn IDisposable>

Holds back the notifications of changes and of Count until the handle is disposed, which raises Count and a reset (SuspendNotifications).
Source§

impl<T> INotifyPropertyChanged for ObservableCollectionExtended<T>

Source§

fn property_changed(&self) -> &Event<str>

The event raised when a property value changes.
Source§

fn as_notify_property_changing(&self) -> Option<&dyn INotifyPropertyChanging>

The object as INotifyPropertyChanging, when it also raises the event of a property that is about to change; None by default. Read more
Source§

impl<T: Clone + PartialEq + 'static> IObservableCollection<T> for ObservableCollectionExtended<T>

Source§

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

The changes applied as to an IExtendedList<T> (ranges at once).

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 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 remove(&self, item: &T) -> bool

Removes item; false when it is not there (Remove).
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).
Source§

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

Whether the collection has item (Contains).
Source§

impl<T: Clone + PartialEq + 'static> ObservableCollectionEx<T> for ObservableCollectionExtended<T>

Source§

fn notifying_collection(&self) -> ObservableCollection<T>

The observable collection whose changes are observed.
Source§

fn observe_collection_changes( &self, ) -> Rc<dyn IObservable<CollectionChangedEventPattern<T>>>

The notifications of the changes of the collection (ObserveCollectionChanges).
Source§

fn to_observable_change_set(&self) -> Rc<dyn IObservable<ChangeSet<T>>>

The items of the collection as change sets of a list: its items first, then each of its changes (ToObservableChangeSet<T>(), ToObservableChangeSet<TCollection, T>()).
Source§

fn to_observable_change_set_with_key<K: Eq + Hash + Clone + 'static>( &self, key_selector: impl Fn(&T) -> K + 'static, ) -> Rc<dyn IObservable<ChangeSet<T, K>>>

to_observable_change_set with each item keyed by key_selector (ToObservableChangeSet<TObject, TKey>(Func<TObject, TKey>)).
Source§

impl<T> PartialEq for ObservableCollectionExtended<T>

Source§

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

The same collection (reference equality).

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.