Update to futures-preview 0.3.0-alpha.16 (#230)

This commit is contained in:
Artem Vorotnikov
2019-05-11 22:18:52 +03:00
committed by Tim
parent 593ac135ce
commit 31abea18b3
22 changed files with 100 additions and 115 deletions

View File

@@ -4,7 +4,7 @@
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
#![feature(arbitrary_self_types, await_macro, async_await)]
#![feature(arbitrary_self_types, async_await)]
use clap::{App, Arg};
use futures::{compat::Executor01CompatExt, prelude::*};
@@ -12,17 +12,17 @@ use std::{io, net::SocketAddr};
use tarpc::{client, context};
async fn run(server_addr: SocketAddr, name: String) -> io::Result<()> {
let transport = await!(bincode_transport::connect(&server_addr))?;
let transport = bincode_transport::connect(&server_addr).await?;
// new_stub is generated by the service! macro. Like Server, it takes a config and any
// Transport as input, and returns a Client, also generated by the macro.
// by the service mcro.
let mut client = await!(service::new_stub(client::Config::default(), transport))?;
let mut client = service::new_stub(client::Config::default(), transport).await?;
// The client has an RPC method for each RPC defined in service!. It takes the same args
// as defined, with the addition of a Context, which is always the first arg. The Context
// specifies a deadline and trace information which can be helpful in debugging requests.
let hello = await!(client.hello(context::current(), name))?;
let hello = client.hello(context::current(), name).await?;
println!("{}", hello);