# CompositeDisposable

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/reactive/struct-compositedisposable/

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

```rust
struct CompositeDisposable
```

A group of disposables that are disposed together.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L7)

## Members

- [`new`](#function-new)
- [`with_capacity`](#function-with_capacity)
- [`from_disposables`](#function-from_disposables)
- [`is_disposed`](#function-is_disposed)
- [`count`](#function-count)
- [`add`](#function-add)
- [`remove`](#function-remove)
- [`contains`](#function-contains)
- [`copy_to`](#function-copy_to)
- [`is_read_only`](#function-is_read_only)
- [`get_enumerator`](#function-get_enumerator)
- [`clear`](#function-clear)

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

### new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L13)

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

### with_capacity

```rust
fn with_capacity(capacity: usize) -> Self
```



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

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

### from_disposables

```rust
fn from_disposables(disposables: impl IntoIterator<Item = Rc<dyn IDisposable>>) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L21)

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

### is_disposed

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L25)

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

### count

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L29)

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

### add

```rust
fn add(self: &Self, item: Rc<dyn IDisposable>)
```

Adds a disposable to the group, or disposes it immediately if the group
has already been disposed.

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

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

### remove

```rust
fn remove(self: &Self, item: &Rc<dyn IDisposable>) -> bool
```

Removes and disposes the first occurrence of `item`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L44)

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

### contains

```rust
fn contains(self: &Self, item: &Rc<dyn IDisposable>) -> bool
```

Whether the group contains `item`. A disposed group is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L59)

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

### copy_to

```rust
fn copy_to(self: &Self, array: &mut [Rc<dyn IDisposable>], array_index: usize)
```

Copies the disposables of the group over the items of `array` that
start at `array_index`. A disposed group copies nothing.

Panics when `array_index` is outside of the array or the array has
not enough room after it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L72)

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

### is_read_only

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

Always false.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L95)

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

### get_enumerator

```rust
fn get_enumerator(self: &Self) -> std::vec::IntoIter<Rc<dyn IDisposable>>
```

Enumerates a copy of the disposables of the group. A disposed group
is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L101)

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

### clear

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

Disposes and removes all items without disposing the group itself.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/reactive/composite_disposable.rs#L111)

## 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`
- `Default`
- [`IDisposable`](/docs/0.5.0/api/ferroui-base/reactive/use-idisposable/)

## Availability

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