mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-24 06:50:08 +08:00
Update docs
This commit is contained in:
parent
b8c35048a4
commit
00fd47f124
@ -27,7 +27,7 @@ import kotlin.coroutines.EmptyCoroutineContext
|
|||||||
@MiraiExperimentalAPI
|
@MiraiExperimentalAPI
|
||||||
suspend inline fun <reified E : Event, R : Any> subscribingGet(
|
suspend inline fun <reified E : Event, R : Any> subscribingGet(
|
||||||
timeoutMillis: Long = -1,
|
timeoutMillis: Long = -1,
|
||||||
noinline filter: E.(E) -> R?
|
noinline filter: E.(E) -> R? // 不要 crossinline: crossinline 后 stacktrace 会不正常
|
||||||
): R {
|
): R {
|
||||||
require(timeoutMillis == -1L || timeoutMillis > 0) { "timeoutMillis must be -1 or > 0" }
|
require(timeoutMillis == -1L || timeoutMillis > 0) { "timeoutMillis must be -1 or > 0" }
|
||||||
return subscribingGetOrNull(timeoutMillis, filter) ?: error("timeout subscribingGet")
|
return subscribingGetOrNull(timeoutMillis, filter) ?: error("timeout subscribingGet")
|
||||||
@ -46,7 +46,7 @@ suspend inline fun <reified E : Event, R : Any> subscribingGet(
|
|||||||
@MiraiExperimentalAPI
|
@MiraiExperimentalAPI
|
||||||
suspend inline fun <reified E : Event, R : Any> subscribingGetOrNull(
|
suspend inline fun <reified E : Event, R : Any> subscribingGetOrNull(
|
||||||
timeoutMillis: Long = -1,
|
timeoutMillis: Long = -1,
|
||||||
noinline filter: E.(E) -> R?
|
noinline filter: E.(E) -> R? // 不要 crossinline: crossinline 后 stacktrace 会不正常
|
||||||
): R? {
|
): R? {
|
||||||
require(timeoutMillis == -1L || timeoutMillis > 0) { "timeoutMillis must be -1 or > 0" }
|
require(timeoutMillis == -1L || timeoutMillis > 0) { "timeoutMillis must be -1 or > 0" }
|
||||||
var result: R? = null
|
var result: R? = null
|
||||||
@ -106,7 +106,7 @@ suspend inline fun <reified E : Event, R : Any> subscribingGetOrNull(
|
|||||||
inline fun <reified E : Event, R : Any> CoroutineScope.subscribingGetAsync(
|
inline fun <reified E : Event, R : Any> CoroutineScope.subscribingGetAsync(
|
||||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||||
timeoutMillis: Long = -1,
|
timeoutMillis: Long = -1,
|
||||||
noinline filter: E.(E) -> R?
|
noinline filter: E.(E) -> R? // 不要 crossinline: crossinline 后 stacktrace 会不正常
|
||||||
): Deferred<R> = this.async(coroutineContext) {
|
): Deferred<R> = this.async(coroutineContext) {
|
||||||
subscribingGet(timeoutMillis, filter)
|
subscribingGet(timeoutMillis, filter)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user