# IReadOnlySelectionList

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/selection/trait-ireadonlyselectionlist/

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

```rust
trait IReadOnlySelectionList<T: Clone + PartialEq + 'static>
```

A read-only, indexable list exposed by a selection model: the selected
indexes (`T` = `i32`) or the selected items (`T` = `Option<_>`, a null
item being `None`).

A list is a view: it reads the selection when it is asked, it does not
copy it. Handles are `Rc<dyn IReadOnlySelectionList<T>>`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L13)

## Members

- [`count`](#function-count)
- [`get`](#function-get)
- [`iter`](#function-iter)
- [`add_collection_changed`](#function-add_collection_changed)
- [`remove_collection_changed`](#function-remove_collection_changed)
- [`is_empty`](#function-is_empty)
- [`contains`](#function-contains)
- [`index_of`](#function-index_of)
- [`to_vec`](#function-to_vec)

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

### count

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

The number of elements.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L15)

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

### get

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

The element at `index`. Panics if the index is out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L18)

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

### iter

```rust
fn iter(self: &Self) -> Box<dyn Iterator<Item = T>>
```

Enumerates the elements.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L21)

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

### add_collection_changed

```rust
fn add_collection_changed(self: &Self, _handler: Rc<ItemsChangedHandler>) -> Option<u64>
```

Subscribes to changes of the list. Returns the token for
`remove_collection_changed`, or
`None` if the list does not notify.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L26)

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

### remove_collection_changed

```rust
fn remove_collection_changed(self: &Self, _token: u64)
```

Unsubscribes a handler.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L31)

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

### is_empty

```rust
fn is_empty(self: &Self) -> bool
```

Whether the list has no elements.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L34)

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

### contains

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

Whether the list contains an element equal to `value`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L39)

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

### index_of

```rust
fn index_of(self: &Self, value: &T) -> i32
```

The index of the first element equal to `value`, or `-1`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L44)

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

### to_vec

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

Copies the elements.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/read_only_selection_list_base.rs#L55)

## Trait implementations

- [`IReadOnlySelectionList<T>`](/docs/0.5.0/api/ferroui-controls/selection/trait-ireadonlyselectionlist/)
- [`IReadOnlySelectionList<i32>`](/docs/0.5.0/api/ferroui-controls/selection/trait-ireadonlyselectionlist/)
- [`IReadOnlySelectionList<Option<T>>`](/docs/0.5.0/api/ferroui-controls/selection/trait-ireadonlyselectionlist/)
- [`IReadOnlySelectionList<Option<Rc<dyn AnyValue>>>`](/docs/0.5.0/api/ferroui-controls/selection/trait-ireadonlyselectionlist/)

## Availability

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