Inline ListenerBuilder

This commit is contained in:
Him188 2019-11-25 13:57:55 +08:00
parent b797ef3cc1
commit 361c0d4f03

View File

@ -136,9 +136,8 @@ suspend inline fun <reified E : Subscribable> subscribeAll(noinline listeners: s
*/
@ListenersBuilderDsl
@Suppress("MemberVisibilityCanBePrivate", "unused")
class ListenerBuilder<out E : Subscribable>(
@PublishedApi
internal val handlerConsumer: suspend (Listener<E>) -> Unit
inline class ListenerBuilder<out E : Subscribable>(
@PublishedApi internal inline val handlerConsumer: suspend (Listener<E>) -> Unit
) {
suspend inline fun handler(noinline listener: suspend (E) -> ListeningStatus) {
handlerConsumer(Handler(listener))