# ViewHostNavigation

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui-controls/struct-viewhostnavigation/

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

```rust
struct ViewHostNavigation
```

Resolves and wires the view a content host displays for a view model (`ViewHostNavigation`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/view_host_navigation.rs#L69)

## Members

- [`resolve_view`](#function-resolve_view)
- [`content_of_view`](#function-content_of_view)
- [`subscribe`](#function-subscribe)
- [`release`](#function-release)

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

### resolve_view

```rust
fn resolve_view<H: IEnableLogger>(host: &H, view_model: Rc<dyn Any>, contract: Option<&str>, view_locator: Option<Rc<dyn IViewLocator>>) -> Option<Rc<dyn IViewFor>>
```

Resolves the view for a view model and hands it the view model (`ResolveView`): the view
gets the view model through its `ViewModel` and, when it is a control, its `DataContext`.
`None` when no view is registered for the view model.

`view_locator` is the locator to use, or `None` for the current one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/view_host_navigation.rs#L77)

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

### content_of_view

```rust
fn content_of_view(view: &Rc<dyn IViewFor>) -> BoxedValue
```

The content that displays `view`: its control, or the view itself when it is not one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/view_host_navigation.rs#L113)

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

### subscribe

```rust
fn subscribe(navigation: Rc<dyn IObservable<NavigationTarget>>, navigate: impl Fn(Option<Rc<dyn Any>>, Option<String>) -> () + 'static) -> Rc<dyn IDisposable>
```

Subscribes a host's navigation stream and returns the subscription it owns while attached
(`Subscribe`); `navigate` displays the view for a target. An error of the stream is
rethrown (`SubscriptionErrors::throw`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/view_host_navigation.rs#L123)

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

### release

```rust
fn release(disposables: &RefCell<Option<Rc<dyn IDisposable>>>)
```

Disposes the supplied subscriptions and clears the reference (`Release`).

The reference is cleared before disposal so a re-entrant detach cannot dispose the same set
twice.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/view_host_navigation.rs#L140)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`

## Availability

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