# Disposable

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

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

```rust
struct Disposable
```

Factory for common `IDisposable` implementations.

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

## Members

- [`empty`](#function-empty)
- [`create`](#function-create)
- [`create_with_state`](#function-create_with_state)

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

### empty

```rust
fn empty() -> Rc<dyn IDisposable>
```

A disposable that does nothing.

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

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

### create

```rust
fn create(action: impl FnOnce() -> () + 'static) -> Rc<dyn IDisposable>
```

A disposable that runs `action` the first time it is disposed.

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

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

### create_with_state

```rust
fn create_with_state<TState: 'static>(state: TState, dispose: impl FnOnce(TState) -> () + 'static) -> Rc<dyn IDisposable>
```

A disposable that gives `state` to `dispose` the first time it is
disposed.

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

## 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/).
