Resolve (resolve v1.0.0)

Dependency injection and resolution at compile time or runtime

Link to this section Summary

Functions

Inject a module in place of another one.

Flag a module as eligible for dependency injection / resolution.

Revert this dependency to the original module.

Link to this section Functions

Link to this function

inject(target_module, injected_module)

@spec inject(target_module :: module(), injected_module :: module()) :: any()

Inject a module in place of another one.

Link to this function

resolve(module)

@spec resolve(module :: module()) :: module()

Flag a module as eligible for dependency injection / resolution.

Defaults to module unless a new dependency is injected in its place.

@spec revert(module :: module()) :: any()

Revert this dependency to the original module.

This function is idempotent and will not fail if Resolve already points to the original module.