mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-13 21:18:18 +01:00
Update to futures-preview 0.3.0-alpha.16 (#230)
This commit is contained in:
@@ -15,7 +15,7 @@ description = "An example server built on tarpc."
|
||||
[dependencies]
|
||||
bincode-transport = { package = "tarpc-bincode-transport", version = "0.6", path = "../bincode-transport" }
|
||||
clap = "2.0"
|
||||
futures-preview = { version = "0.3.0-alpha.15", features = ["compat"] }
|
||||
futures-preview = { version = "0.3.0-alpha.16", features = ["compat"] }
|
||||
serde = { version = "1.0" }
|
||||
tarpc = { version = "0.17", path = "../tarpc", features = ["serde1"] }
|
||||
tokio = "0.1"
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -4,12 +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,
|
||||
proc_macro_hygiene
|
||||
)]
|
||||
#![feature(arbitrary_self_types, async_await, proc_macro_hygiene)]
|
||||
|
||||
// This is the service definition. It looks a lot like a trait definition.
|
||||
// It defines one RPC, hello, which takes one arg, name, and returns a String.
|
||||
|
||||
@@ -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::{
|
||||
@@ -47,7 +47,7 @@ async fn run(server_addr: SocketAddr) -> io::Result<()> {
|
||||
// the generated Service trait.
|
||||
.respond_with(service::serve(HelloServer));
|
||||
|
||||
await!(server);
|
||||
server.await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user