templates.ScalaCommon.txt.Marshallers.template.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pekko-grpc-codegen_2.13 Show documentation
Show all versions of pekko-grpc-codegen_2.13 Show documentation
Apache Pekko gRPC - Support for building streaming gRPC servers and clients on top of Pekko Streams.
The newest version!
package templates.ScalaCommon.txt
import _root_.play.twirl.api.TwirlFeatureImports._
import _root_.play.twirl.api.TwirlHelperImports._
import _root_.play.twirl.api.Html
import _root_.play.twirl.api.JavaScript
import _root_.play.twirl.api.Txt
import _root_.play.twirl.api.Xml
object Marshallers extends _root_.play.twirl.api.BaseScalaTemplate[play.twirl.api.TxtFormat.Appendable,_root_.play.twirl.api.Format[play.twirl.api.TxtFormat.Appendable]](play.twirl.api.TxtFormat) with _root_.play.twirl.api.Template1[org.apache.pekko.grpc.gen.scaladsl.Service,play.twirl.api.TxtFormat.Appendable] {
/*
* Copyright (C) 2018-2021 Lightbend Inc.
*/
def apply/*14.2*/(service: org.apache.pekko.grpc.gen.scaladsl.Service):play.twirl.api.TxtFormat.Appendable = {
_display_ {
{
Seq[Any](format.raw/*15.1*/("""
"""),_display_(/*16.2*/org/*16.5*/.apache.pekko.grpc.gen.Constants.DoNotEditComment),format.raw/*16.54*/("""
"""),format.raw/*17.1*/("""package """),_display_(/*17.10*/service/*17.17*/.packageName),format.raw/*17.29*/("""
"""),format.raw/*19.1*/("""import scala.concurrent.ExecutionContext
import org.apache.pekko
import pekko.actor.ClassicActorSystemProvider
import pekko.stream.Materializer
import pekko.grpc.GrpcProtocol.GrpcProtocolWriter
import pekko.grpc.ProtobufSerializer
import pekko.grpc.scaladsl.GrpcMarshalling
import pekko.grpc.scaladsl.ScalapbProtobufSerializer
import pekko.http.scaladsl.marshalling.Marshaller
import pekko.http.scaladsl.marshalling.ToResponseMarshaller
import pekko.http.scaladsl.model.HttpRequest
import pekko.http.scaladsl.unmarshalling.FromRequestUnmarshaller
import pekko.http.scaladsl.unmarshalling.Unmarshaller
import pekko.grpc.PekkoGrpcGenerated
@PekkoGrpcGenerated
object """),_display_(/*37.9*/{service.name}),format.raw/*37.23*/("""Marshallers """),format.raw/*37.35*/("""{"""),format.raw/*37.36*/("""
"""),_display_(/*38.4*/for(serializer <- service.serializers) yield /*38.42*/ {_display_(Seq[Any](format.raw/*38.44*/("""
"""),format.raw/*39.3*/("""implicit val """),_display_(/*39.17*/serializer/*39.27*/.name),format.raw/*39.32*/(""": ScalapbProtobufSerializer["""),_display_(/*39.61*/{serializer.scalaType}),format.raw/*39.83*/("""] = """),_display_(/*39.88*/{service.packageName}),format.raw/*39.109*/("""."""),_display_(/*39.111*/{service.name}),format.raw/*39.125*/(""".Serializers."""),_display_(/*39.139*/{serializer.name}),format.raw/*39.156*/("""
""")))}),format.raw/*40.4*/("""
"""),format.raw/*42.3*/("""implicit def unmarshaller[T](implicit serializer: ProtobufSerializer[T], mat: Materializer): FromRequestUnmarshaller[T] =
Unmarshaller((_: ExecutionContext) => (req: HttpRequest) => GrpcMarshalling.unmarshal(req)(serializer, mat))
implicit def toSourceUnmarshaller[T](implicit serializer: ProtobufSerializer[T], mat: Materializer): FromRequestUnmarshaller[pekko.stream.scaladsl.Source[T, pekko.NotUsed]] =
Unmarshaller((_: ExecutionContext) => (req: HttpRequest) => GrpcMarshalling.unmarshalStream(req)(serializer, mat))
implicit def marshaller[T](implicit serializer: ProtobufSerializer[T], writer: GrpcProtocolWriter, system: ClassicActorSystemProvider): ToResponseMarshaller[T] =
Marshaller.opaque((response: T) => GrpcMarshalling.marshal(response)(serializer, writer, system))
implicit def fromSourceMarshaller[T](implicit serializer: ProtobufSerializer[T], writer: GrpcProtocolWriter, system: ClassicActorSystemProvider): ToResponseMarshaller[pekko.stream.scaladsl.Source[T, pekko.NotUsed]] =
Marshaller.opaque((response: pekko.stream.scaladsl.Source[T, pekko.NotUsed]) => GrpcMarshalling.marshalStream(response)(serializer, writer, system))
"""),format.raw/*53.1*/("""}"""),format.raw/*53.2*/("""
"""))
}
}
}
def render(service:org.apache.pekko.grpc.gen.scaladsl.Service): play.twirl.api.TxtFormat.Appendable = apply(service)
def f:((org.apache.pekko.grpc.gen.scaladsl.Service) => play.twirl.api.TxtFormat.Appendable) = (service) => apply(service)
def ref: this.type = this
}
/*
-- GENERATED --
SOURCE: codegen/src/main/twirl/templates/ScalaCommon/Marshallers.scala.txt
HASH: 3fa9f772ac339c64400ecdbdad2d8bb6a8dcb8dc
MATRIX: 692->364|839->418|867->420|878->423|948->472|976->473|1012->482|1028->489|1061->501|1090->503|1785->1173|1820->1187|1860->1199|1889->1200|1919->1204|1973->1242|2013->1244|2043->1247|2084->1261|2103->1271|2129->1276|2185->1305|2228->1327|2260->1332|2303->1353|2333->1355|2369->1369|2411->1383|2450->1400|2484->1404|2515->1408|3714->2580|3742->2581
LINES: 16->14|21->15|22->16|22->16|22->16|23->17|23->17|23->17|23->17|25->19|43->37|43->37|43->37|43->37|44->38|44->38|44->38|45->39|45->39|45->39|45->39|45->39|45->39|45->39|45->39|45->39|45->39|45->39|45->39|46->40|48->42|59->53|59->53
-- GENERATED --
*/
© 2015 - 2025 Weber Informatics LLC | Privacy Policy