# ModernDependencyResolver

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-splat/service_location/struct-moderndependencyresolver/

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

```rust
struct ModernDependencyResolver
```

A resolver that keeps a list of factories per service type and contract
(`ModernDependencyResolver`): the last registration wins for `get_service`, `get_services`
returns them all in the order of registration, and a registration runs the callbacks of its
key.

The registry is copied on write: a factory or a callback that registers while the registry is
read does not change what is being read.

A missing contract and the empty contract are the same key.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Splat/service_location/modern_dependency_resolver.rs#L59)

## Members

- [`new`](#function-new)
- [`duplicate`](#function-duplicate)

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

### new

```rust
fn new() -> Self
```

An empty resolver.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Splat/service_location/modern_dependency_resolver.rs#L74)

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

### duplicate

```rust
fn duplicate(self: &Self) -> Self
```

A new resolver with the registrations of this one, without its callbacks (`Duplicate`).
The lazy singletons are shared with this resolver.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Splat/service_location/modern_dependency_resolver.rs#L89)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`IDependencyResolver`](/docs/0.5.0/api/ferroui-splat/service_location/trait-idependencyresolver/)
- [`ReadonlyDependencyResolverExt`](/docs/0.5.0/api/ferroui-splat/service_location/trait-readonlydependencyresolverext/)
- [`MutableDependencyResolverExt`](/docs/0.5.0/api/ferroui-splat/service_location/trait-mutabledependencyresolverext/)
- [`ResolverMixins`](/docs/0.5.0/api/ferroui-splat/service_location/trait-resolvermixins/)
- [`ServiceLocationInitializationExt`](/docs/0.5.0/api/ferroui-splat/service_location/trait-servicelocationinitializationext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `Default`
- [`IReadonlyDependencyResolver`](/docs/0.5.0/api/ferroui-splat/service_location/trait-ireadonlydependencyresolver/)
- [`IMutableDependencyResolver`](/docs/0.5.0/api/ferroui-splat/service_location/trait-imutabledependencyresolver/)
- [`IDisposable`](/docs/0.5.0/api/ferroui-base/reactive/use-idisposable/)

## Availability

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