# IObservableCollection

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-dynamic-data/binding/trait-iobservablecollection/

**trait** · [`ferroui-dynamic-data`](/docs/0.5.0/api/ferroui-dynamic-data/) · v0.5.0

```rust
trait IObservableCollection<T: Clone + PartialEq + 'static>: INotifyCollectionChanged + INotifyPropertyChanged + INotifyCollectionChangedSuspender
```

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.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L27)

## Members

- [`count`](#function-count)
- [`get`](#function-get)
- [`set`](#function-set)
- [`insert`](#function-insert)
- [`remove_at`](#function-remove_at)
- [`clear`](#function-clear)
- [`to_vec`](#function-to_vec)
- [`add`](#function-add)
- [`index_of`](#function-index_of)
- [`contains`](#function-contains)
- [`remove`](#function-remove)
- [`load`](#function-load)
- [`move_item`](#function-move_item)
- [`clone_changes`](#function-clone_changes)

<a id="function-count"></a>

### count

```rust
fn count(self: &Self) -> usize
```

The number of items (`Count`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L29)

<a id="function-get"></a>

### get

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L31)

<a id="function-set"></a>

### set

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L33)

<a id="function-insert"></a>

### insert

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

Inserts an item (`Insert`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L35)

<a id="function-remove_at"></a>

### remove_at

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

Removes the item at `index` (`RemoveAt`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L37)

<a id="function-clear"></a>

### clear

```rust
fn clear(self: &Self)
```

Removes every item (`Clear`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L39)

<a id="function-to_vec"></a>

### to_vec

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

A copy of the items.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L41)

<a id="function-add"></a>

### add

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

Adds an item at the end (`Add`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L44)

<a id="function-index_of"></a>

### index_of

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

The index of `item` (`IndexOf`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L50)

<a id="function-contains"></a>

### contains

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

Whether the collection has `item` (`Contains`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L55)

<a id="function-remove"></a>

### remove

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L60)

<a id="function-load"></a>

### load

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

Clears the collection and adds the items (`Load`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L71)

<a id="function-move_item"></a>

### move_item

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

Moves the item at `old_index` to `new_index` (`Move`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L74)

<a id="function-clone_changes"></a>

### clone_changes

```rust
fn clone_changes(self: &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>`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/binding/i_observable_collection.rs#L79)

## Trait implementations

- [`IObservableCollection<T>`](/docs/0.5.0/api/ferroui-dynamic-data/binding/trait-iobservablecollection/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
