# ISuspensionHost

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/interfaces/trait-isuspensionhost/

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

```rust
trait ISuspensionHost: IReactiveObject
```

The events of the life of the process that the host operating system publishes, in one form
(`ISuspensionHost`): subscribe to them to save and restore the state of the application when
it is suspended and resumed.

The observables abstract the terms of each platform ("launching", "activated", "closing") so
that shared code persists its state without knowing the user-interface toolkit. Most
applications call
`setup_default_suspend_resume`
at startup; the observables are settable so that a host can plug in its own monitoring.

The state of the application is an object the application defines, type-erased here
(`app_state`); `create_new_app_state` makes a
fresh one on the first launch or after a crash.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L26)

## Members

- [`is_launching_new`](#function-is_launching_new)
- [`set_is_launching_new`](#function-set_is_launching_new)
- [`is_resuming`](#function-is_resuming)
- [`set_is_resuming`](#function-set_is_resuming)
- [`is_unpausing`](#function-is_unpausing)
- [`set_is_unpausing`](#function-set_is_unpausing)
- [`should_persist_state`](#function-should_persist_state)
- [`set_should_persist_state`](#function-set_should_persist_state)
- [`should_invalidate_state`](#function-should_invalidate_state)
- [`set_should_invalidate_state`](#function-set_should_invalidate_state)
- [`create_new_app_state`](#function-create_new_app_state)
- [`set_create_new_app_state`](#function-set_create_new_app_state)
- [`app_state`](#function-app_state)
- [`set_app_state`](#function-set_app_state)

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

### is_launching_new

```rust
fn is_launching_new(self: &Self) -> Rc<dyn IObservable<()>>
```

Ticks when the application is launched anew, after a crash or the first time: the
application creates its state from scratch (`IsLaunchingNew`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L29)

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

### set_is_launching_new

```rust
fn set_is_launching_new(self: &Self, value: Rc<dyn IObservable<()>>)
```

Sets `is_launching_new`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L32)

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

### is_resuming

```rust
fn is_resuming(self: &Self) -> Rc<dyn IObservable<()>>
```

Ticks when the application resumes from the suspended state: it was running, but its
process was destroyed (`IsResuming`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L36)

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

### set_is_resuming

```rust
fn set_is_resuming(self: &Self, value: Rc<dyn IObservable<()>>)
```

Sets `is_resuming`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L39)

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

### is_unpausing

```rust
fn is_unpausing(self: &Self) -> Rc<dyn IObservable<()>>
```

Ticks when the application is activated; the process may not have been running before
(`IsUnpausing`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L43)

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

### set_is_unpausing

```rust
fn set_is_unpausing(self: &Self, value: Rc<dyn IObservable<()>>)
```

Sets `is_unpausing`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L46)

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

### should_persist_state

```rust
fn should_persist_state(self: &Self) -> Rc<dyn IObservable<Rc<dyn IDisposable>>>
```

Ticks when the application should persist its state; the value is disposed once the state
is persisted (`ShouldPersistState`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L50)

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

### set_should_persist_state

```rust
fn set_should_persist_state(self: &Self, value: Rc<dyn IObservable<Rc<dyn IDisposable>>>)
```

Sets `should_persist_state`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L53)

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

### should_invalidate_state

```rust
fn should_invalidate_state(self: &Self) -> Rc<dyn IObservable<()>>
```

Ticks when the saved state should be deleted, usually after a crash
(`ShouldInvalidateState`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L57)

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

### set_should_invalidate_state

```rust
fn set_should_invalidate_state(self: &Self, value: Rc<dyn IObservable<()>>)
```

Sets `should_invalidate_state`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L60)

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

### create_new_app_state

```rust
fn create_new_app_state(self: &Self) -> Option<AppStateFactory>
```

The function that creates a new state of the application (`CreateNewAppState`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L63)

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

### set_create_new_app_state

```rust
fn set_create_new_app_state(self: &Self, value: Option<AppStateFactory>)
```

Sets `create_new_app_state`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L66)

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

### app_state

```rust
fn app_state(self: &Self) -> Option<Rc<dyn Any>>
```

The current state of the application (`AppState`); see
`get_app_state` for a typed view.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L70)

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

### set_app_state

```rust
fn set_app_state(self: &Self, value: Option<Rc<dyn Any>>)
```

Sets `app_state`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/interfaces/i_suspension_host.rs#L73)

## Trait implementations

- [`ISuspensionHost`](/docs/0.5.0/api/ferroui-reactiveui/interfaces/trait-isuspensionhost/)

## Availability

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