# IFerroReadOnlyList

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/collections/trait-iferroreadonlylist/

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

```rust
trait IFerroReadOnlyList<T>: INotifyCollectionChanged + INotifyPropertyChanged
```

A read-only notifying list.

The members of the read-only list contract it extends (count, indexer,
enumeration) are part of the trait, together with the typed form of the
collection changed event, which carries the items;
`INotifyCollectionChanged` is its untyped form.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/collections/i_ferro_read_only_list.rs#L11)

## Members

- [`count`](#function-count)
- [`get`](#function-get)
- [`snapshot`](#function-snapshot)
- [`add_collection_changed`](#function-add_collection_changed)
- [`remove_collection_changed`](#function-remove_collection_changed)

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

### count

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

The number of items in the list.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/collections/i_ferro_read_only_list.rs#L13)

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

### get

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

The item at `index`. Panics if out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/collections/i_ferro_read_only_list.rs#L16)

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

### snapshot

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

The items, as a snapshot that stays unchanged if the list is
modified (enumeration).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/collections/i_ferro_read_only_list.rs#L20)

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

### add_collection_changed

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

Subscribes to changes. Returns a token for
`remove_collection_changed`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/collections/i_ferro_read_only_list.rs#L24)

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

### remove_collection_changed

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

Unsubscribes a handler.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/collections/i_ferro_read_only_list.rs#L27)

## Trait implementations

- [`IFerroReadOnlyList<T>`](/docs/0.5.0/api/ferroui-base/collections/trait-iferroreadonlylist/)

## Availability

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