All Downloads are FREE. Search and download functionalities are using the official Maven repository.

endless.protobuf.ProtobufIncomingCommand.scala Maven / Gradle / Ivy

There is a newer version: 0.31.0
Show newest version
package endless.protobuf

import endless.core.protocol.{Encoder, IncomingCommand}
import scalapb.{GeneratedMessage, GeneratedMessageCompanion}

class ProtobufIncomingCommand[F[_], R <: GeneratedMessage: GeneratedMessageCompanion, A, Alg[_[_]]](
    run: Alg[F] => F[A],
    replyContramapper: A => R
) extends IncomingCommand[F, Alg] {
  override type Reply = A
  override def runWith(alg: Alg[F]): F[A] = run(alg)
  override def replyEncoder: Encoder[A] = ProtobufEncoder[R].contramap(replyContramapper)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy