# Change

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

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

```rust
struct Change<T>
```

A change of a list (`Change<T>`): of one item, or of a range of items.

Upstream's change of one item has an empty range (`RangeChange<T>.Empty`), and a change of a
range has an empty item (`ItemChange<T>.Empty`, whose item is the default value of `T`); here
`range` is empty for the change of an item, and the change of a range has no
item (`try_item`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L13)

## Members

- [`new`](#function-new)
- [`range_change`](#function-range_change)
- [`moved`](#function-moved)
- [`with_previous`](#function-with_previous)
- [`reason`](#function-reason)
- [`change_type`](#function-change_type)
- [`item`](#function-item)
- [`try_item`](#function-try_item)
- [`range`](#function-range)

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

### new

```rust
fn new(reason: ListChangeReason, current: T, index: Option<usize>) -> Self
```

The change of one item (`Change(ListChangeReason, T, int index = -1)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L21)

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

### range_change

```rust
fn range_change(reason: ListChangeReason, items: Vec<T>, index: Option<usize>) -> Self
```

The change of a range (`Change(ListChangeReason, IEnumerable<T>, int index = -1)`).
## Panics
For a reason of one item (`IndexOutOfRangeException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L29)

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

### moved

```rust
fn moved(current: T, current_index: usize, previous_index: usize) -> Self
```

A move (`Change(T, int currentIndex, int previousIndex)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L35)

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

### with_previous

```rust
fn with_previous(reason: ListChangeReason, current: T, previous: Option<T>, current_index: Option<usize>, previous_index: Option<usize>) -> Self
```

The change of one item with every part (`Change(ListChangeReason, T, in Optional<T>, int,
int)`).
## Panics
For `Add` with a previous item, `Replace` without one, and `Refresh` without an index
(`ArgumentException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L49)

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

### reason

```rust
fn reason(self: &Self) -> ListChangeReason
```

The reason (`Reason`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L57)

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

### change_type

```rust
fn change_type(self: &Self) -> ChangeType
```

Whether the change is of an item or of a range (`Type`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L62)

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

### item

```rust
fn item(self: &Self) -> &ItemChange<T>
```

The change of the item (`Item`).
## Panics
For the change of a range, whose item upstream is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L70)

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

### try_item

```rust
fn try_item(self: &Self) -> Option<&ItemChange<T>>
```

The change of the item, `None` for the change of a range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L75)

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

### range

```rust
fn range(self: &Self) -> &RangeChange<T>
```

The range (`Range`): empty for the change of an item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.DynamicData/list/change.rs#L80)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `Equivalent<K>`
- `Clone`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Hash`
- `Debug`
- `FromIterator<Change<T>>`

## Availability

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