I am looking at this akka-http docs example (which links to akka-http test code):
This is actually a test from github code MarshalSpec.scala. My question is, where is the implicit Marshaller imported here? I am looking at imports, and I couldn't find it? I tried using IntelliJ to show me implicit imports, but I still couldn't figure this out. Where is the import statement that gets the implicit declaration for a Marshaller that is passed to:
val entityFuture = Marshal(string).to[MessageEntity]
at line 21? It calls
def to[B](implicit m: Marshaller[A, B], ec: ExecutionContext): Future[B] =
in Marshal.scala and passes an implicit m: Marshaller, which I can't pinpoint.
Marshaller
extends PredefinedToEntityMarshallers
, which provides marshalling from String.
But, why does Marshaller comes with its own implicits ? It's because scala search for implicits in the implicit scope of type arguments : Where does Scala look for implicits?
So, Marshaller comes with its own Marshallers ready to use :)