mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-07 16:40:43 +08:00
Make CombinedStateObserver.toString
more readable
This commit is contained in:
parent
750ab0db37
commit
f4ec905aff
@ -49,7 +49,16 @@ internal class CombinedStateObserver(
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "CombinedStateObserver(first=$first, last=$last)"
|
||||
return asSequence().joinToString(
|
||||
prefix = "CombinedStateObserver[",
|
||||
postfix = "]",
|
||||
separator = " -> "
|
||||
) { it.toString() }
|
||||
}
|
||||
|
||||
private fun asSequence(): Sequence<StateObserver> = sequence {
|
||||
if (first is CombinedStateObserver) yieldAll(first.asSequence()) else yield(first)
|
||||
if (last is CombinedStateObserver) yieldAll(last.asSequence()) else yield(last)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
Loading…
Reference in New Issue
Block a user