rememberFactory

inline fun <A : Any, T : Any> rememberFactory(tag: Any? = null): LazyDelegate<(A) -> T>

Retrieves and keeps a reference on a factory of T for the given argument type, return type and tag.

A & T generics will be preserved!

Return

A factory.

Parameters

A

The type of argument the factory takes.

T

The type of object the factory returns.

tag

The bound tag, if any. If changed during composition, a new instance will be re-injected.

Throws

DI.NotFoundException

if no factory was found.

DI.DependencyLoopException

When calling the factory function, if the instance construction triggered a dependency loop.