rocketraman
03/17/2023, 3:25 PMfun DI.Builder.bindFoo() = bind<Foo>().inSet()
which I could then call like this:
bindFoo() with singleton { ... }
It looks like inSet
is deprecated now, and I have to create my convenience function like this:
fun DI.Builder.bindFoo(binding: () -> DIBinding<*, *, out Foo>) =
inBindSet { add(binding) }
which is ugly since the DIBinding
type is no longer inferred by the compiler as its a parameter rather than a return value. Am I missing something?
(More in thread)typealias DITypeBinding<T> = () -> DIBinding<*, *, out T>
and now I can declare:
fun DI.Builder.bindFoo(binding: DITypeBinding<Foo>) =
inBindSet { add(binding) }
but its still a bit ugly.