# IFerroReadOnlyDictionary

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

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

```rust
trait IFerroReadOnlyDictionary<K, V>: INotifyCollectionChanged + INotifyPropertyChanged
```

A read-only notifying dictionary.

The members of the read-only dictionary contract it extends are part of
the trait, together with the typed form of the collection changed event,
which carries the entries; `INotifyCollectionChanged` is its untyped
form.

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

## Members

- [`count`](#function-count)
- [`get`](#function-get)
- [`try_get_value`](#function-try_get_value)
- [`contains_key`](#function-contains_key)
- [`keys`](#function-keys)
- [`values`](#function-values)
- [`to_vec`](#function-to_vec)
- [`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 entries.

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

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

### get

```rust
fn get(self: &Self, key: &K) -> V
```

The value for `key`. Panics if the key is not present.

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

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

### try_get_value

```rust
fn try_get_value(self: &Self, key: &K) -> Option<V>
```

The value for `key`, if present.

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

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

### contains_key

```rust
fn contains_key(self: &Self, key: &K) -> bool
```



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

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

### keys

```rust
fn keys(self: &Self) -> Vec<K>
```

The keys, in enumeration order.

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

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

### values

```rust
fn values(self: &Self) -> Vec<V>
```

The values, in enumeration order.

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

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

### to_vec

```rust
fn to_vec(self: &Self) -> Vec<(K, V)>
```

The entries, in enumeration order (enumeration).

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

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

### add_collection_changed

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

Subscribes to changes of the collection. Returns a token for
`remove_collection_changed`.

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

<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_dictionary.rs#L39)

## Trait implementations

- [`IFerroReadOnlyDictionary<K, V>`](/docs/0.5.0/api/ferroui-base/collections/trait-iferroreadonlydictionary/)

## Availability

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