AbstractBindingDefDSL

izumi.distage.model.definition.dsl.AbstractBindingDefDSL
See theAbstractBindingDefDSL companion object
trait AbstractBindingDefDSL[BindDSL[_], BindDSLAfterFrom[_], SetDSL[_]] extends AbstractBindingDefDSLMacro[BindDSL], FunctoidBindImplicitsVersionSpecific

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
AbstractBindingDefDSL[BindDSL, BindDSLAfterFrom, SetDSL]

Members list

Type members

Classlikes

final class MutationContext

Use this to create utility functions that add bindings mutably to the current module, as opposed to creating new modules and including them.

Use this to create utility functions that add bindings mutably to the current module, as opposed to creating new modules and including them.

Example:

 import distage.{ClassConstructor, Tag, ModuleDef}
 import izumi.distage.model.definition.dsl.ModuleDefDSL

 trait RegisteredComponent
 class RegisteredComponentImpl extends RegisteredComponent

 def addAndRegister[T <: RegisteredComponent: Tag: ClassConstructor](implicit mutateModule: ModuleDefDSL#MutationContext): Unit = {
   new mutateModule.dsl {
     make[T]

     many[RegisteredComponent]
       .weak[T]
   }
 }

 new ModuleDef {
   addAndRegister[RegisteredComponentImpl]
 }

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Inherited methods

final inline def bindAllImplicits[I, N <: IndiscriminateFunctoidDummyImplicit](inline f: N ?=> Functoid[I]): Functoid[I]

Like bindImplicits, but converts even fully resolved implicits into Functoid parameters.

Like bindImplicits, but converts even fully resolved implicits into Functoid parameters.

This may not be what you want, because this will also capture global utility implicits such as DummyImplicit, ClassTag and scala.collection.Factory, and turn them into DI parameters.

Attributes

Inherited from:
FunctoidBindImplicitsVersionSpecific
final inline def bindImplicits[I, N <: UnresolvedOnlyFunctoidDummyImplicit](inline f: N ?=> Functoid[I]): Functoid[I]

Convert unresolved implicits in the following code block, lambda or a method reference into explicit parameters that will be resolved from the object graph, not the implicit context.

Convert unresolved implicits in the following code block, lambda or a method reference into explicit parameters that will be resolved from the object graph, not the implicit context.

Example:

 final case class X(a: Int, b: Double)

 // LAMBDA:

 make[X].from(bindImplicits {
   (i: Int) => X(i, implicitly[Double])
 }

 // transforms into:

 make[X].from {
   (i: Int, d: Double) => X(i, d)
 }

 // CODE BLOCK:

 make[X].from(bindImplicits {
   X(implicitly[Int], implicitly[Double])
 })

 // transforms into:

 make[X].from {
   (i: Int, d: Double) => X(i, d)
 }

 // METHOD REFERENCE:

 def createX(i: Int)(implicit d: Double, dx: DummyImplicit): X = X(i, d)

 make[X].from(bindImplicits {
   createX
 })

 // transforms into:

 make[X].from {
   (i: Int, d: Double) => createX(i)(using d, DummyImplicit.dummyImplicit)
 }

 // because search for DummyImplicit was __resolved__ in current implicit scope, it was taken from the implicit context,
 // not from the object graph!

Attributes

Note

This function is available inside ModuleDef DSL, but it can also be called outside of it as Functoid.bindImplicits

Inherited from:
FunctoidBindImplicitsVersionSpecific
final inline protected def make[T]: BindDSL[T]

Attributes

Inherited from:
AbstractBindingDefDSLMacro