mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-23 15:49:54 +01:00
Move generated functions under their corresponding items.
- fn serve -> Service::serve - fn new_stub -> Client::new This allows the generated function names to remain consistent across service definitions while preventing collisions.
This commit is contained in:
@@ -44,9 +44,9 @@ async fn main() -> io::Result<()> {
|
||||
|
||||
let transport = json_transport::connect(&server_addr).await?;
|
||||
|
||||
// world_stub is generated by the service attribute. Like Server, it takes a config and any
|
||||
// Transport as input, and returns a Client, also generated by the attribute.
|
||||
let mut client = service::world_stub(client::Config::default(), transport).await?;
|
||||
// WorldClient is generated by the service attribute. It has a constructor `new` that takes a
|
||||
// config and any Transport as input.
|
||||
let mut client = service::WorldClient::new(client::Config::default(), transport).await?;
|
||||
|
||||
// The client has an RPC method for each RPC defined in the annotated trait. It takes the same
|
||||
// args as defined, with the addition of a Context, which is always the first arg. The Context
|
||||
|
||||
Reference in New Issue
Block a user