# FerroDictionaryExtensions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/collections/struct-ferrodictionaryextensions/

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

```rust
struct FerroDictionaryExtensions
```

Defines extension methods for working with `FerroDictionary`s.

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

## Members

- [`for_each_item`](#function-for_each_item)

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

### for_each_item

```rust
fn for_each_item<K, V, D>(collection: &D, added: impl Fn(&K, &V) -> () + 'static, removed: impl Fn(&K, &V) -> () + 'static, reset: impl Fn() -> () + 'static, weak_subscription: bool) -> Rc<dyn IDisposable>
where K: Clone + 'static,
      V: Clone + 'static,
      D: IFerroReadOnlyDictionary<K, V> + WeakEventSender
```

Invokes an action for each item in a collection and subsequently each
item added or removed from the collection.

`added` is called initially for each item in the collection and
subsequently for each item added to the collection, with the key and
the value; `removed` for each item removed from the collection;
`reset` when the collection is reset, which is followed by calls to
`added` for each item present in the collection after the reset.
`weak_subscription` indicates if a weak subscription should be used to
track changes to the collection (held by the returned disposable, see
`FerroListExtensions::for_each_item_indexed`).
Returns a disposable used to terminate the subscription.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`

## Availability

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