# Controls

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-controls/

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

```rust
struct Controls
```

A collection of [`Control`](/docs/0.5.0/api/ferroui-controls/struct-control/)s.

The value is a shared handle: clones refer to the same collection, and
handles compare by identity.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/controls.rs#L11)

## Members

- [`new`](#function-new)
- [`from_items`](#function-from_items)
- [`add`](#function-add)
- [`insert`](#function-insert)
- [`remove`](#function-remove)
- [`set`](#function-set)

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

### new

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

Creates an empty collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/controls.rs#L23)

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

### from_items

```rust
fn from_items(items: impl IntoIterator<Item = Ref<Control>>) -> Self
```

Creates a collection with the initial items.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/controls.rs#L30)

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

### add

```rust
fn add(self: &Self, item: impl IntoRef<Control>)
```

Adds a control (of any class) to the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/controls.rs#L37)

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

### insert

```rust
fn insert(self: &Self, index: usize, item: impl IntoRef<Control>)
```

Inserts a control (of any class) at the specified index.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/controls.rs#L42)

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

### remove

```rust
fn remove(self: &Self, item: impl IntoRef<Control>) -> bool
```

Removes a control (of any class) from the collection. Returns true if
it was present.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/controls.rs#L48)

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

### set

```rust
fn set(self: &Self, index: usize, item: impl IntoRef<Control>)
```

Replaces the control at `index`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/controls.rs#L53)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ToOwned`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `StructuralPartialEq`
- `PartialEq`
- `Debug`
- `Default`
- `Deref`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

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