pub struct Container<'a> { /* private fields */ }
Expand description

Represents a store to register and retrieve objects.

Implementations

Constructs a new Container.

Adds a scoped factory function.

Returns

Ok(()) if the provider was added, or Err(Provider) if there is a provider registered for that type.

Adds a scoped factory function with a name.

Returns

Ok(()) if the provider was added, or Err(Provider) if there is a provider registered for that type.

Adds a singleton.

Returns

Ok(()) if the provider was added, or Err(Provider) if there is a provider registered for that type.

Adds a singleton with a name.

Returns

Ok(()) if the provider was added, or Err(Provider) if there is a provider registered for that type.

Adds a scoped Inject that depends on others providers.

Returns

Ok(()) if the provider was added, or Err(Provider) if there is a provider registered for that type.

Adds a scoped named Inject that depends on others providers.

Returns

Ok(()) if the provider was added, or Err(Provider) if there is a provider registered for that type.

Adds a scoped Inject that depends on others providers.

Returns

Ok(()) if the provider was added, or Err(Provider) if there is a provider registered for that type.

Adds a scoped named Inject that depends on others providers.

Returns

Ok(()) if the provider was added, or Err(Provider) if there is a provider registered for that type.

Returns a value registered for the given type or None if no provider is register for the given type.

The returning value could be either scoped or a singleton.

Returns a value registered for the given type and name or None if no provider is register for the given type.

The returning value could be either scoped or a singleton.

Returns all the values registered for the given type.

Returns a value registered for the given type, or None if no provider is register for the given type.

Returns a value registered for the given type and name, or None if no provider is register for the given type and name.

Returns a singleton registered for the given type, or None if no provider is register for the given type.

Returns a singleton registered for the given type and name, or None if no provider is register for the given type and name.

Returns true if the Container have a provider for the given InjectionKey.

Removes the provider with the given InjectionKey and returns it, or None if the provider is not found.

Returns the number of providers in this Container.

Returns true is this container have no providers.

Removes all the providers in this Container.

Returns an iterator over the providers of this container.

Returns an iterator over the keys and providers of this container.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.