# VisualStatesDictionary

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-livecharts/visual_states/struct-visualstatesdictionary/

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

```rust
struct VisualStatesDictionary
```

Reusable visual-state definitions. A user's definition takes precedence
over a theme definition, regardless of registration order.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L100)

## Members

- [`new`](#function-new)
- [`insert`](#function-insert)
- [`get`](#function-get)
- [`iter`](#function-iter)
- [`len`](#function-len)
- [`is_empty`](#function-is_empty)
- [`contains_key`](#function-contains_key)
- [`set_state`](#function-set_state)
- [`clear_state`](#function-clear_state)
- [`clear_states`](#function-clear_states)

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

### new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L104)

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

### insert

```rust
fn insert(self: &mut Self, name: impl Into<String>, state: DrawnPropertiesDictionary) -> bool
```

Adds or replaces a state using source `HasState` precedence. Returns
false only when a theme tries to replace a user's definition.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L109)

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

### get

```rust
fn get(self: &Self, name: &str) -> Option<&DrawnPropertiesDictionary>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L119)

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

### iter

```rust
fn iter(self: &Self) -> impl Iterator<Item = (&str, &DrawnPropertiesDictionary)>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L122)

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

### len

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L127)

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

### is_empty

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L130)

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

### contains_key

```rust
fn contains_key(self: &Self, name: &str) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L133)

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

### set_state

```rust
fn set_state(self: &Self, name: &str, target: &mut Animatable, now_ms: f64) -> Result<(), StateError>
```

Applies setters every time and behaviors only on first activation.
Unregistered properties are ignored. Known property types are checked
before changes are made, so a bad setter cannot leave a half-applied state.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L140)

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

### clear_state

```rust
fn clear_state(self: &Self, name: &str, target: &mut Animatable, now_ms: f64) -> Result<(), StateError>
```

Removes a state, restoring each property from the most recently activated
remaining state, or from its original target when no state still sets it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L185)

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

### clear_states

```rust
fn clear_states(self: &Self, target: &mut Animatable, now_ms: f64) -> Result<(), StateError>
```

Restores original values once and reverses each active behavior, in
activation order. No global timer or target-identity table is involved.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/visual_states/visual_states_dictionary.rs#L245)

## Trait implementations

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

## Availability

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