# ViewModelType

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

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

```rust
struct ViewModelType
```

The compile-time type of a view model, as a value (what upstream's `TViewModel` gives a generic
resolution): its `TypeId`, its name, and how to ask the service locator for its view
(`IViewFor<TViewModel>`, here `dyn IViewForOf<VM>`).

Not an upstream type: Rust cannot close `IViewFor<>` over a type known only at run time
(`MakeGenericType`), so the lookup is made where the type is known, by `of`.

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

## Members

- [`of`](#function-of)
- [`id`](#function-id)
- [`type_name`](#function-type_name)
- [`service_view`](#function-service_view)

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

### of

```rust
fn of<VM: 'static>() -> Self
```

The type `VM`.

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

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

### id

```rust
fn id(self: &Self) -> TypeId
```

The `TypeId` of the type.

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

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

### type_name

```rust
fn type_name(self: &Self) -> &'static str
```

The name of the type (`Type.Name`, here the path of the type).

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

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

### service_view

```rust
fn service_view(self: &Self, contract: Option<&str>) -> Option<Rc<dyn IViewFor>>
```

The last view registered in the service locator as `dyn IViewForOf<VM>` under `contract`
(`None` and an empty contract are the default registration), or `None`
(`AppLocator.Current.GetService<IViewFor<TViewModel>>(contract)`).

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `Clone`
- `Copy`
- `Debug`
- `PartialEq`
- `Eq`

## Availability

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