# IRegistrar

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

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

```rust
trait IRegistrar
```

Registers services with a dependency injection container without reflection (`IRegistrar`):
what an `IWantsToRegisterStuff` registers its services with.

Deviation (DEVIATIONS.md, ReactiveUI): upstream's methods are generic in the type of the
service; a trait object cannot have generic methods, so the trait has the methods of the
erased services, keyed by their `ServiceType`, as Splat's resolvers do, and the generic
methods of upstream are those of [`RegistrarExt`](/docs/0.5.0/api/ferroui-reactiveui/registration/trait-registrarext/), which every registrar has.

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

## Members

- [`register_constant_erased`](#function-register_constant_erased)
- [`register_lazy_singleton_erased`](#function-register_lazy_singleton_erased)
- [`register_erased`](#function-register_erased)

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

### register_constant_erased

```rust
fn register_constant_erased(self: &Self, factory: Box<dyn FnOnce() -> ErasedService>, service_type: ServiceType, contract: Option<&str>)
```

Registers the value that `factory` creates, once, as a constant of `service_type`
(`RegisterConstant<TService>(Func<TService>, string?)`).

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

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

### register_lazy_singleton_erased

```rust
fn register_lazy_singleton_erased(self: &Self, factory: ServiceFactory, service_type: ServiceType, contract: Option<&str>)
```

Registers `factory` as a lazy singleton of `service_type`: it creates the value the first
time it is resolved (`RegisterLazySingleton<TService>(Func<TService>, string?)`).

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

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

### register_erased

```rust
fn register_erased(self: &Self, factory: ServiceFactory, service_type: ServiceType, contract: Option<&str>)
```

Registers `factory`, which creates a value each time `service_type` is resolved
(`Register<TService>(Func<TService>, string?)`).

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

## Trait implementations

- [`IRegistrar`](/docs/0.5.0/api/ferroui-reactiveui/registration/trait-iregistrar/)

## Availability

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