add inline functions in DoWithFirstBuilder

This commit is contained in:
InsanusMokrassar 2021-02-05 16:09:08 +06:00
parent d06bb265e5
commit 012c7e9bdf

View File

@ -16,6 +16,8 @@ class DoWithFirstBuilder<T>(
operator fun plus(block: suspend CoroutineScope.() -> T) {
deferreds.add(scope.async(start = CoroutineStart.LAZY, block = block))
}
inline fun add(noinline block: suspend CoroutineScope.() -> T) = plus(block)
inline fun include(noinline block: suspend CoroutineScope.() -> T) = plus(block)
fun build() = deferreds.toList()
}