# UIElementWeakCollection

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-uielementweakcollection/

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

```rust
struct UIElementWeakCollection
```

A collection of elements held weakly (WinUI
`Microsoft.UI.Xaml.UIElementWeakCollection`, `IVector<UIElement>`): an
element that is gone reads as `None` and stays in the collection until it
is removed.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L154)

## Members

- [`size`](#function-size)
- [`get_at`](#function-get_at)
- [`index_of`](#function-index_of)
- [`contains`](#function-contains)
- [`append`](#function-append)
- [`insert_at`](#function-insert_at)
- [`set_at`](#function-set_at)
- [`remove_at`](#function-remove_at)
- [`remove`](#function-remove)
- [`remove_at_end`](#function-remove_at_end)
- [`clear`](#function-clear)
- [`items`](#function-items)
- [`replace_all`](#function-replace_all)

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

### size

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

`Size`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L169)

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

### get_at

```rust
fn get_at(self: &Self, index: usize) -> Option<Ref<Visual>>
```

`GetAt`: the element at `index`, `None` when it is gone.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L174)

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

### index_of

```rust
fn index_of(self: &Self, element: &Visual) -> Option<usize>
```

`IndexOf`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L179)

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

### contains

```rust
fn contains(self: &Self, element: &Visual) -> bool
```

Whether `element` is in the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L184)

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

### append

```rust
fn append(self: &Self, element: &Visual) -> Result<(), ThemeShadowError>
```

`Append`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L189)

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

### insert_at

```rust
fn insert_at(self: &Self, index: usize, element: &Visual) -> Result<(), ThemeShadowError>
```

`InsertAt`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L196)

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

### set_at

```rust
fn set_at(self: &Self, index: usize, element: &Visual) -> Result<(), ThemeShadowError>
```

`SetAt`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L206)

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

### remove_at

```rust
fn remove_at(self: &Self, index: usize) -> Result<(), ThemeShadowError>
```

`RemoveAt`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L216)

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

### remove

```rust
fn remove(self: &Self, element: &Visual) -> bool
```

Removes `element`; `false` when it is not in the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L225)

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

### remove_at_end

```rust
fn remove_at_end(self: &Self) -> Result<(), ThemeShadowError>
```

`RemoveAtEnd`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L236)

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

### clear

```rust
fn clear(self: &Self)
```

`Clear`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L244)

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

### items

```rust
fn items(self: &Self) -> Vec<Ref<Visual>>
```

`GetMany` from the start: the elements that are still alive.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L249)

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

### replace_all

```rust
fn replace_all(self: &Self, elements: &[&Visual]) -> Result<(), ThemeShadowError>
```

`ReplaceAll`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L254)

## 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>`
- `Any`
- `ErasedDestructor`
- `IntoEither`

## Availability

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