add CustomInputProvider

This commit is contained in:
InsanusMokrassar 2022-03-06 18:37:24 +06:00
parent f5b71dcb84
commit 445e2b4c06

View File

@ -28,6 +28,11 @@ expect class FileBasedInputProvider : SimpleInputProvider {
val file: MPPFile val file: MPPFile
} }
@Serializable(SimpleInputProviderSerializer::class)
class CustomInputProvider(private val provider: () -> Input) : SimpleInputProvider {
override fun invoke(): Input = provider()
}
object SimpleInputProviderSerializer : KSerializer<SimpleInputProvider> { object SimpleInputProviderSerializer : KSerializer<SimpleInputProvider> {
private val serializer = ByteArraySerializer() private val serializer = ByteArraySerializer()
override val descriptor: SerialDescriptor override val descriptor: SerialDescriptor