# RegistrarExt

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

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

```rust
trait RegistrarExt: IRegistrar
```

The generic methods of [`IRegistrar`](/docs/0.5.0/api/ferroui-reactiveui/registration/trait-iregistrar/) (`IRegistrar`'s `RegisterConstant<TService>`,
`RegisterLazySingleton<TService>` and `Register<TService>`). The service may be a trait object
(`registrar.register_constant::<dyn IViewLocator>(..)`).

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

## Members

- [`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)
- [`register`](#function-register)
- [`register_with_contract`](#function-register_with_contract)

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

### register_constant

```rust
fn register_constant<S: ?Sized + 'static>(self: &Self, factory: impl FnOnce() -> Rc<S> + 'static)
```

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

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

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

### register_constant_with_contract

```rust
fn register_constant_with_contract<S: ?Sized + 'static>(self: &Self, factory: impl FnOnce() -> Rc<S> + 'static, contract: Option<&str>)
```

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

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

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

### register_lazy_singleton

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

Registers `factory` as a lazy singleton (`RegisterLazySingleton<TService>(Func<TService>)`).

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

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

### register_lazy_singleton_with_contract

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

Registers `factory` as a lazy singleton under `contract`
(`RegisterLazySingleton<TService>(Func<TService>, string?)`).

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

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

### register

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

Registers `factory`, which creates a value at each resolution (`Register<TService>(Func<TService>)`).

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

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

### register_with_contract

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

Registers `factory` under `contract` (`Register<TService>(Func<TService>, string?)`).

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

## Trait implementations

- [`RegistrarExt`](/docs/0.5.0/api/ferroui-reactiveui/registration/trait-registrarext/)

## Availability

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