# AppLocator

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

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

```rust
struct AppLocator
```

The service locator of the application (`AppLocator`): the current resolver, which
applications and libraries resolve their services from, and the notifications of its changes.

It starts with an empty `InstanceGenericFirstDependencyResolver`; `set_locator` replaces
it.




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

## Members

- [`current`](#function-current)
- [`current_mutable`](#function-current_mutable)
- [`register_resolver_initializer`](#function-register_resolver_initializer)
- [`set_locator`](#function-set_locator)
- [`get_locator`](#function-get_locator)
- [`register_resolver_callback_changed`](#function-register_resolver_callback_changed)
- [`suppress_resolver_callback_changed_notifications`](#function-suppress_resolver_callback_changed_notifications)
- [`are_resolver_callback_changed_notifications_enabled`](#function-are_resolver_callback_changed_notifications_enabled)
- [`get_service`](#function-get_service)
- [`get_service_with_contract`](#function-get_service_with_contract)
- [`get_services`](#function-get_services)
- [`get_services_with_contract`](#function-get_services_with_contract)
- [`has_registration`](#function-has_registration)
- [`has_registration_with_contract`](#function-has_registration_with_contract)
- [`register`](#function-register)
- [`register_with_contract`](#function-register_with_contract)
- [`register_constant`](#function-register_constant)
- [`register_constant_with_contract`](#function-register_constant_with_contract)
- [`register_lazy_singleton`](#function-register_lazy_singleton)
- [`register_lazy_singleton_with_contract`](#function-register_lazy_singleton_with_contract)
- [`unregister_current`](#function-unregister_current)
- [`unregister_current_with_contract`](#function-unregister_current_with_contract)
- [`unregister_all`](#function-unregister_all)
- [`unregister_all_with_contract`](#function-unregister_all_with_contract)

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

### current

```rust
fn current() -> Rc<dyn IReadonlyDependencyResolver>
```

The current resolver, to resolve services from (`Current`).

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

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

### current_mutable

```rust
fn current_mutable() -> Rc<dyn IMutableDependencyResolver>
```

The current resolver, to register services with (`CurrentMutable`).

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

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

### register_resolver_initializer

```rust
fn register_resolver_initializer(initializer: impl Fn(&dyn IMutableDependencyResolver) -> () + 'static)
```

Sets what the locator runs on every new resolver (`RegisterResolverInitializer`); it
replaces the previous initializer.

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

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

### set_locator

```rust
fn set_locator(dependency_resolver: Rc<dyn IDependencyResolver>)
```

Makes `dependency_resolver` the current resolver and notifies the callbacks
(`SetLocator`).

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

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

### get_locator

```rust
fn get_locator() -> Rc<dyn IDependencyResolver>
```

The current resolver (`GetLocator`).

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

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

### register_resolver_callback_changed

```rust
fn register_resolver_callback_changed(callback: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
```

Calls `callback` now, while notifications are enabled, and whenever the resolver changes,
until the returned disposable is disposed (`RegisterResolverCallbackChanged`).

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

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

### suppress_resolver_callback_changed_notifications

```rust
fn suppress_resolver_callback_changed_notifications() -> Rc<dyn IDisposable>
```

Suppresses the notifications of the changes of the resolver until the returned disposable
is disposed (`SuppressResolverCallbackChangedNotifications`).

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

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

### are_resolver_callback_changed_notifications_enabled

```rust
fn are_resolver_callback_changed_notifications_enabled() -> bool
```

`AreResolverCallbackChangedNotificationsEnabled`.

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

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

### get_service

```rust
fn get_service<S: ?Sized + 'static>() -> Option<Rc<S>>
```

`GetService<T>()` of the current resolver.

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

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

### get_service_with_contract

```rust
fn get_service_with_contract<S: ?Sized + 'static>(contract: &str) -> Option<Rc<S>>
```

`GetService<T>(string contract)` of the current resolver.

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

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

### get_services

```rust
fn get_services<S: ?Sized + 'static>() -> Vec<Rc<S>>
```

`GetServices<T>()` of the current resolver.

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

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

### get_services_with_contract

```rust
fn get_services_with_contract<S: ?Sized + 'static>(contract: &str) -> Vec<Rc<S>>
```

`GetServices<T>(string contract)` of the current resolver.

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

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

### has_registration

```rust
fn has_registration<S: ?Sized + 'static>() -> bool
```

`HasRegistration<T>()` of the current resolver.

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

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

### has_registration_with_contract

```rust
fn has_registration_with_contract<S: ?Sized + 'static>(contract: &str) -> bool
```

`HasRegistration<T>(string contract)` of the current resolver.

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

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

### register

```rust
fn register<S: ?Sized + 'static>(factory: impl Fn() -> Option<Rc<S>> + 'static)
```

`Register<T>(Func<T?>)` with the current resolver.

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

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

### register_with_contract

```rust
fn register_with_contract<S: ?Sized + 'static>(factory: impl Fn() -> Option<Rc<S>> + 'static, contract: &str)
```

`Register<T>(Func<T?>, string contract)` with the current resolver.

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

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

### register_constant

```rust
fn register_constant<S: ?Sized + 'static>(value: Rc<S>)
```

`RegisterConstant<T>(T)` with the current resolver.

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

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

### register_constant_with_contract

```rust
fn register_constant_with_contract<S: ?Sized + 'static>(value: Rc<S>, contract: &str)
```

`RegisterConstant<T>(T, string contract)` with the current resolver.

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

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

### register_lazy_singleton

```rust
fn register_lazy_singleton<S: ?Sized + 'static>(factory: impl Fn() -> Option<Rc<S>> + 'static)
```

`RegisterLazySingleton<T>(Func<T?>)` with the current resolver.

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

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

### register_lazy_singleton_with_contract

```rust
fn register_lazy_singleton_with_contract<S: ?Sized + 'static>(factory: impl Fn() -> Option<Rc<S>> + 'static, contract: &str)
```

`RegisterLazySingleton<T>(Func<T?>, string contract)` with the current resolver.

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

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

### unregister_current

```rust
fn unregister_current<S: ?Sized + 'static>()
```

`UnregisterCurrent<T>()` of the current resolver.

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

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

### unregister_current_with_contract

```rust
fn unregister_current_with_contract<S: ?Sized + 'static>(contract: &str)
```

`UnregisterCurrent<T>(string contract)` of the current resolver.

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

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

### unregister_all

```rust
fn unregister_all<S: ?Sized + 'static>()
```

`UnregisterAll<T>()` of the current resolver.

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

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

### unregister_all_with_contract

```rust
fn unregister_all_with_contract<S: ?Sized + 'static>(contract: &str)
```

`UnregisterAll<T>(string contract)` of the current resolver.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`

## Availability

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