A provider that uses a factory function (or other callable) to get the value.

Arguments to the function are resolved using a Resolver (typically a Container). If an Injectable annotation is on the definition of the function, then the template arguments to the Injectable determine how the injected arguments should be resolved. Otherwise, the argument types for the function are used.

The function can either be passed as an alias function argument or as a parameter to the constructor, depending on the needs of the user.

  1. class FactoryProvider(alias F)
    class FactoryProvider : Provider () if (
    ) {}
  2. class FactoryProvider(F)


this(Resolver resolver)

Parameters: resolver is used to resolve the arguments to the factory function which could be either be specified using an Injectable annotation, or inferred from the parameter list of the function.

Inherited Members

From Provider

void withProvided(void delegate(void*) dg)

Produce the value. A pointer to the value is passed to a delegate.

T provide()

Provied the value. T must be the same type represented by the TypeInfo returned by providedType.

TypeInfo providedType [@property getter]

Return a TypeInfo describing the type provided.