[][src]Attribute Macro tarpc::service

#[service]

The main macro that creates RPC services.

Rpc methods are specified, mirroring trait syntax:

#[tarpc::service]
trait Service {
/// Say hello
async fn hello(name: String) -> String;
}

Attributes can be attached to each rpc. These attributes will then be attached to the generated service traits' corresponding fns, as well as to the client stubs' RPCs.

The following items are expanded in the enclosing module:

  • trait Service -- defines the RPC service.
    • fn serve -- turns a service impl into a request handler.
  • Client -- a client stub with a fn for each RPC.
    • fn new_stub -- creates a new Client stub. Generates:
  • service trait
  • serve fn
  • client stub struct
  • new_stub client factory fn
  • Request and Response enums
  • ResponseFut Future