Base trait for traits or classes "implementing" FullRPCInfo in various RPC frameworks.
Base trait for traits or classes "implementing" FullRPCInfo in various RPC frameworks. Having a separate subtrait/subclass for every framework is beneficial for ScalaJS DCE.
This type must be defined as trait or class by an RPCFramework in order to be able to use it's RPCCompanion.
This type must be defined as trait or class by an RPCFramework in order to be able to use it's RPCCompanion. The fact that every RPCFramework may define its own trait or class for FullRPCInfo helps ScalaJS DCE distinguish between instances of AsRawRPC, AsRealRPC and RPCMetadata for different frameworks and to get rid of unused instances.
object SomeRPCFramework extends RPCFramework { abstract class FullRPCInfo[T] extends BaseFullRPCInfo[T] ... }
Convenience abstract class for companion objects of RPC interfaces.
Convenience abstract class for companion objects of RPC interfaces. Makes sure all three RPC type classes (AsRawRPC, AsRealRPC and RPCMetadata) are macro-materialized for that RPC interface and confines macro materialization to the same compilation unit where the RPC interface is defined. This is a good practice to avoid incremental compilation problems and duplication of macro-generated code in various callsites. In order to be able to use RPCCompanion, the RPC framework must define FullRPCInfo as a trait or class. Additionally, some special wizardry has been employed to make sure that when an RPC interface is a part of shared (cross-compiled) code of a ScalaJS application then ScalaJS optimizer can remove unused instances of macro generated typeclasses.
object SomeRPCFramework extends StandardRPCFramework { ... } @RPC trait SomeRPC { def doSomething(str: String): Unit def callSomething(int: Int): Future[String] } object SomeRPC extends SomeRPCFramework.RPCCompanion[SomeRPC]
Materializes a factory of implementations of RawRPC which translate invocations of its raw methods
to invocations of actual methods on rpcImpl
.
Materializes a factory of implementations of RawRPC which translate invocations of its raw methods
to invocations of actual methods on rpcImpl
. Method arguments and results are serialized and deserialized
from/to RawValue using Reader and Writer typeclasses.
Materializes a factory of implementations of T
which are proxies that implement all abstract methods of T
by forwarding them to rawRpc
.
Materializes a factory of implementations of T
which are proxies that implement all abstract methods of T
by forwarding them to rawRpc
. Method arguments and results are serialized and deserialized
from/to RawValue using Reader and Writer typeclasses.
INTERNAL API
INTERNAL API
Mix in this trait into your RPC framework to support remote procedures, i.e. fire-and-forget methods with
Unit
return type.