# SuspensionHostExtensions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/suspension/trait-suspensionhostextensions/

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

```rust
trait SuspensionHostExtensions
```

The state of the application of a suspension host, and the default handling of its suspension
(the extension members of `ISuspensionHost` in `SuspensionHostExtensions`), on its shared
handle.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/suspension/suspension_host_extensions.rs#L88)

## Members

- [`get_app_state`](#function-get_app_state)
- [`observe_app_state`](#function-observe_app_state)
- [`setup_default_suspend_resume`](#function-setup_default_suspend_resume)
- [`setup_default_suspend_resume_with`](#function-setup_default_suspend_resume_with)

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

### get_app_state

```rust
fn get_app_state<T: 'static>(self: &Self) -> Option<Rc<T>>
```

The state of the application as a `T`, loaded first when the setup armed a load and it has
not run yet (`GetAppState<T>()`); `None` when there is no state.

Panics when the state is of another type (`InvalidCastException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/suspension/suspension_host_extensions.rs#L93)

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

### observe_app_state

```rust
fn observe_app_state<T: 'static>(self: &Self) -> Rc<dyn IObservable<Rc<T>>>
```

The state of the application as a `T`: the current one on subscription, then each one set;
a state that is `None` or of another type is skipped (`ObserveAppState<T>()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/suspension/suspension_host_extensions.rs#L99)

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

### setup_default_suspend_resume

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

Sets up the default suspension and resumption with the driver registered in `AppLocator`
(`SetupDefaultSuspendResume()`); see
`setup_default_suspend_resume_with`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/suspension/suspension_host_extensions.rs#L104)

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

### setup_default_suspend_resume_with

```rust
fn setup_default_suspend_resume_with(self: &Self, driver: Option<Rc<dyn ISuspensionDriver>>) -> Rc<dyn IDisposable>
```

Sets up the default suspension and resumption with `driver`, or the one registered in
`AppLocator` as `dyn ISuspensionDriver` when `None` (`SetupDefaultSuspendResume(ISuspensionDriver?)`):
the state is loaded once, when the application launches or resumes, or before it is first
read or saved, and created anew when there is none or the load fails; it is saved when the
host says it should persist, and invalidated when it says so. Without a driver, an error is
logged and nothing is set up.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/suspension/suspension_host_extensions.rs#L112)

## Trait implementations

- [`SuspensionHostExtensions`](/docs/0.5.0/api/ferroui-reactiveui/suspension/trait-suspensionhostextensions/)

## Availability

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