# SourceCache

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-dynamic-data/cache/struct-sourcecache/

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

```rust
struct SourceCache<T, K>
```

The source of a reactive keyed collection (`SourceCache<TObject, TKey>`): edits make change
sets, which `connect` delivers to the operators.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/source_cache.rs#L21)

## Members

- [`new`](#function-new)
- [`edit`](#function-edit)
- [`suspend_count`](#function-suspend_count)
- [`suspend_notifications`](#function-suspend_notifications)
- [`as_observable_cache_inner`](#function-as_observable_cache_inner)

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

### new

```rust
fn new(key_selector: impl Fn(&T) -> K + 'static) -> Self
```

An empty cache whose items are keyed by `key_selector`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/source_cache.rs#L34)

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

### edit

```rust
fn edit(self: &Self, update: impl FnOnce(&mut dyn ISourceUpdater<T, K>) -> ())
```

Runs an edit (`Edit(Action<ISourceUpdater>)`).

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

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

### suspend_count

```rust
fn suspend_count(self: &Self) -> Rc<dyn IDisposable>
```

Holds back the notifications of count changes (`SuspendCount`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/source_cache.rs#L46)

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

### suspend_notifications

```rust
fn suspend_notifications(self: &Self) -> Rc<dyn IDisposable>
```

Holds back the notifications of changes (`SuspendNotifications`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/source_cache.rs#L51)

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

### as_observable_cache_inner

```rust
fn as_observable_cache_inner(self: &Self) -> &ObservableCache<T, K>
```

The observable cache this source edits.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/cache/source_cache.rs#L56)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`SourceCacheEx<T, K>`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-sourcecacheex/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`CacheChangeSetSource`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-cachechangesetsource/)
- `Clone`
- [`IConnectableCache<T, K>`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-iconnectablecache/)
- [`IObservableCache<T, K>`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-iobservablecache/)
- [`ISourceCache<T, K>`](/docs/0.5.0/api/ferroui-dynamic-data/cache/trait-isourcecache/)
- [`IDisposable`](/docs/0.5.0/api/ferroui-base/reactive/use-idisposable/)

## Availability

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