# IViewForOf

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

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

```rust
trait IViewForOf<VM: 'static>: IViewFor
```

A view that displays a view model of the type `VM` (`IViewFor<T>`).

Its accessors have the names of those of [`IViewFor`](/docs/0.5.0/api/ferroui-reactiveui/binding/interfaces/trait-iviewfor/), as upstream's `new T? ViewModel` hides
the untyped one: where both traits are in scope, a call on a generic view names the trait
(`IViewForOf::<VM>::view_model(&*view)`). The macro `view_for!` also gives
the view inherent accessors, which a call on the concrete type finds first.

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

## Members

- [`view_model`](#function-view_model)
- [`set_view_model`](#function-set_view_model)

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

### view_model

```rust
fn view_model(self: &Self) -> Option<Rc<VM>>
```

The view model displayed by the view (the getter of `ViewModel`).

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

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

### set_view_model

```rust
fn set_view_model(self: &Self, view_model: Option<Rc<VM>>)
```

Sets the view model displayed by the view (the setter of `ViewModel`).

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

## Availability

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