# MutableDependencyResolverExtensions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/registration/trait-mutabledependencyresolverextensions/

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

```rust
trait MutableDependencyResolverExtensions: IMutableDependencyResolver
```

The registration of the views of view models without reflection
(`MutableDependencyResolverExtensions`): a view type with a default constructor is registered
as the `dyn IViewForOf<VM>` of its view model.

As upstream's static constructor, the first call on a thread checks that ReactiveUI was
initialized (`RxAppBuilder::ensure_initialized`), and panics if it was not.

Deviation (DEVIATIONS.md, ReactiveUI): upstream's static constructor runs once per process;
the check runs once per thread, as the state of ReactiveUI is per thread.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/registration/mutable_dependency_resolver_extensions.rs#L32)

## Members

- [`register_view_for_view_model`](#function-register_view_for_view_model)
- [`register_view_for_view_model_with_contract`](#function-register_view_for_view_model_with_contract)
- [`register_singleton_view_for_view_model`](#function-register_singleton_view_for_view_model)
- [`register_singleton_view_for_view_model_with_contract`](#function-register_singleton_view_for_view_model_with_contract)

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

### register_view_for_view_model

```rust
fn register_view_for_view_model<V: IViewForOf<VM> + Default + 'static, VM: 'static>(self: &Self) -> &Self
```

Registers `V` as the view of `VM`, a new view at each resolution
(`RegisterViewForViewModel<TView, TViewModel>()`); returns the resolver, to chain the
calls.

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

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

### register_view_for_view_model_with_contract

```rust
fn register_view_for_view_model_with_contract<V: IViewForOf<VM> + Default + 'static, VM: 'static>(self: &Self, contract: Option<&str>) -> &Self
```

Registers `V` as the view of `VM` under `contract`, a new view at each resolution
(`RegisterViewForViewModel<TView, TViewModel>(string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/registration/mutable_dependency_resolver_extensions.rs#L42)

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

### register_singleton_view_for_view_model

```rust
fn register_singleton_view_for_view_model<V: IViewForOf<VM> + Default + 'static, VM: 'static>(self: &Self) -> &Self
```

Registers `V` as the view of `VM`, one view created at the first resolution
(`RegisterSingletonViewForViewModel<TView, TViewModel>()`).

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

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

### register_singleton_view_for_view_model_with_contract

```rust
fn register_singleton_view_for_view_model_with_contract<V: IViewForOf<VM> + Default + 'static, VM: 'static>(self: &Self, contract: Option<&str>) -> &Self
```

Registers `V` as the view of `VM` under `contract`, one view created at the first
resolution (`RegisterSingletonViewForViewModel<TView, TViewModel>(string?)`).

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

## Trait implementations

- [`MutableDependencyResolverExtensions`](/docs/0.5.0/api/ferroui-reactiveui/registration/trait-mutabledependencyresolverextensions/)

## Availability

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