Tear out requirement that Transport's error type is io::Error.

This commit is contained in:
Tim Kuehn
2021-03-28 23:28:01 -07:00
parent 7b7c182411
commit 21e2f7ca62
19 changed files with 300 additions and 207 deletions

View File

@@ -30,7 +30,7 @@ async fn main() -> anyhow::Result<()> {
// WorldClient is generated by the service attribute. It has a constructor `new` that takes a
// config and any Transport as input.
let client = WorldClient::new(client::Config::default(), transport.await?).spawn()?;
let client = WorldClient::new(client::Config::default(), transport.await?).spawn();
let hello = async move {
// Send the request twice, just to be safe! ;)

View File

@@ -12,7 +12,7 @@ use rand::{
};
use service::{init_tracing, World};
use std::{
net::{IpAddr, SocketAddr},
net::{IpAddr, Ipv6Addr, SocketAddr},
time::Duration,
};
use tarpc::{
@@ -40,7 +40,7 @@ impl World for HelloServer {
let sleep_time =
Duration::from_millis(Uniform::new_inclusive(1, 10).sample(&mut thread_rng()));
time::sleep(sleep_time).await;
format!("Hello, {}! You are connected from {:?}.", name, self.0)
format!("Hello, {}! You are connected from {}", name, self.0)
}
}
@@ -49,7 +49,7 @@ async fn main() -> anyhow::Result<()> {
let flags = Flags::parse();
let _uninstall = init_tracing("Tarpc Example Server")?;
let server_addr = (IpAddr::from([0, 0, 0, 0]), flags.port);
let server_addr = (IpAddr::V6(Ipv6Addr::LOCALHOST), flags.port);
// JSON transport is provided by the json_transport tarpc module. It makes it easy
// to start up a serde-powered json serialization strategy over TCP.