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_3 Show documentation
Show all versions of pekko-grpc-codegen_3 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 scala.language.adhocExtensions
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: db39bc16f20818a7c8466a6a41004d5001423fe2
MATRIX: 730->364|877->418|905->420|916->423|986->472|1014->473|1050->482|1066->489|1099->501|1128->503|1823->1173|1858->1187|1898->1199|1927->1200|1957->1204|2011->1242|2051->1244|2081->1247|2122->1261|2141->1271|2167->1276|2223->1305|2266->1327|2298->1332|2341->1353|2371->1355|2407->1369|2449->1383|2488->1400|2522->1404|2553->1408|3752->2580|3780->2581
LINES: 17->14|22->15|23->16|23->16|23->16|24->17|24->17|24->17|24->17|26->19|44->37|44->37|44->37|44->37|45->38|45->38|45->38|46->39|46->39|46->39|46->39|46->39|46->39|46->39|46->39|46->39|46->39|46->39|46->39|47->40|49->42|60->53|60->53
-- GENERATED --
*/
© 2015 - 2025 Weber Informatics LLC | Privacy Policy