# RefTrackingDictionary

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/utilities/struct-reftrackingdictionary/

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

```rust
struct RefTrackingDictionary<TKey>
```

Maintains a set of objects with reference counts

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/ref_tracking_dictionary.rs#L6)

## Members

- [`new`](#function-new)
- [`add_ref`](#function-add_ref)
- [`release_ref`](#function-release_ref)

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

### new

```rust
fn new() -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/ref_tracking_dictionary.rs#L17)

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

### add_ref

```rust
fn add_ref(self: &mut Self, key: TKey) -> bool
```

Increase reference count for a key by 1.

Returns true if key was added to the dictionary, false otherwise.

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

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

### release_ref

```rust
fn release_ref(self: &mut Self, key: &TKey) -> bool
```

Decrease reference count for a key by 1.

Returns true if key was removed to the dictionary, false otherwise.
A key without a reference panics in a debug build and returns false
otherwise.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/ref_tracking_dictionary.rs#L35)

## 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>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Default`
- `Deref`
- `DerefMut`

## Availability

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