mirror of
https://github.com/OMGeeky/tarpc.git
synced 2025-12-26 17:02:32 +01:00
Client RPCs now take &self.
This required the breaking change of removing the Client trait. The intent of the Client trait was to facilitate the decorator pattern by allowing users to create their own Clients that added behavior on top of the base client. Unfortunately, this trait had become a maintenance burden, consistently causing issues with lifetimes and the lack of generic associated types. Specifically, it meant that Client impls could not use async fns, which is no longer tenable today.
This commit is contained in:
@@ -47,8 +47,7 @@ async fn main() -> io::Result<()> {
|
||||
|
||||
// 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?).spawn()?;
|
||||
let client = service::WorldClient::new(client::Config::default(), transport.await?).spawn()?;
|
||||
|
||||
// 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