mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-24 06:50:08 +08:00
Inline ListenerBuilder
This commit is contained in:
parent
b797ef3cc1
commit
361c0d4f03
@ -136,9 +136,8 @@ suspend inline fun <reified E : Subscribable> subscribeAll(noinline listeners: s
|
|||||||
*/
|
*/
|
||||||
@ListenersBuilderDsl
|
@ListenersBuilderDsl
|
||||||
@Suppress("MemberVisibilityCanBePrivate", "unused")
|
@Suppress("MemberVisibilityCanBePrivate", "unused")
|
||||||
class ListenerBuilder<out E : Subscribable>(
|
inline class ListenerBuilder<out E : Subscribable>(
|
||||||
@PublishedApi
|
@PublishedApi internal inline val handlerConsumer: suspend (Listener<E>) -> Unit
|
||||||
internal val handlerConsumer: suspend (Listener<E>) -> Unit
|
|
||||||
) {
|
) {
|
||||||
suspend inline fun handler(noinline listener: suspend (E) -> ListeningStatus) {
|
suspend inline fun handler(noinline listener: suspend (E) -> ListeningStatus) {
|
||||||
handlerConsumer(Handler(listener))
|
handlerConsumer(Handler(listener))
|
||||||
|
Loading…
Reference in New Issue
Block a user