binary command protocol minimalistic test

This commit is contained in:
sergeych committed 2022-09-07 11:45:06 +03:00
1 parent 5b94ab1bfd
commit db7a85fb7b
11 files changed
+548 -21

No files matched your search

@@ -0,0 +1,20 @@
package channel
import kotlin.reflect.KType
class CommandDescriptor<I, A, R>(
val name: String,
val ass: KType,
val rss: KType,
) {
suspend operator fun invoke(adapter: Adapter<I>, args: A): R =
adapter.invokeCommand(this, args)
@Suppress("UNCHECKED_CAST")
suspend operator fun invoke(adapter: Adapter<I>): R = adapter.invokeCommand(this,Unit as A)
operator fun invoke(commandHost: CommandHost<I>, block: suspend I.(A)->R) {
commandHost.on(this, block)
}
}