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:
Tim Kuehn
2021-03-07 17:33:31 -08:00
parent ce4fd49161
commit e75193c191
15 changed files with 114 additions and 453 deletions

View File

@@ -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