diff --git a/capnp-rpc/src/lib.rs b/capnp-rpc/src/lib.rs index 48767990b..f186e3325 100644 --- a/capnp-rpc/src/lib.rs +++ b/capnp-rpc/src/lib.rs @@ -462,7 +462,7 @@ where /// Converts a promise for a client into a client that queues up any calls that arrive /// before the promise resolves. -#[deprecated(since = "0.20.2", note = "use `new_deferred_client()` instead")] +#[deprecated(since = "0.20.2", note = "use `new_future_client()` instead")] pub fn new_promise_client(client_promise: F) -> T where T: ::capnp::capability::FromClientHook, @@ -485,7 +485,7 @@ where /// Creates a `Client` from a future that resolves to a `Client`. /// /// Any calls that arrive before the resolution are accumulated in a queue. -pub fn new_deferred_client( +pub fn new_future_client( client_future: impl ::futures::Future> + 'static, ) -> T where diff --git a/capnp-rpc/test/impls.rs b/capnp-rpc/test/impls.rs index e8f92dc73..9a9feab6d 100644 --- a/capnp-rpc/test/impls.rs +++ b/capnp-rpc/test/impls.rs @@ -745,7 +745,7 @@ impl test_promise_resolve::resolver::Server for ResolverImpl { return Promise::err(Error::failed("no sender".into())); }; let (snd, rcv) = oneshot::channel(); - let _ = sender.send(capnp_rpc::new_deferred_client( + let _ = sender.send(capnp_rpc::new_future_client( rcv.map_err(|_| Error::failed("oneshot was canceled".to_string())), )); self.sender = Some(snd); @@ -776,7 +776,7 @@ impl test_promise_resolve::Server for TestPromiseResolveImpl { let (snd, rcv) = oneshot::channel(); let resolver = ResolverImpl { sender: Some(snd) }; let mut results_root = results.get(); - results_root.set_cap(capnp_rpc::new_deferred_client( + results_root.set_cap(capnp_rpc::new_future_client( rcv.map_err(|_| Error::failed("oneshot was canceled".to_string())), )); results_root.set_resolver(capnp_rpc::new_client(resolver)); diff --git a/capnp-rpc/test/reconnect_test.rs b/capnp-rpc/test/reconnect_test.rs index 4c0160b56..1a255be33 100644 --- a/capnp-rpc/test/reconnect_test.rs +++ b/capnp-rpc/test/reconnect_test.rs @@ -5,7 +5,7 @@ use std::rc::Rc; use capnp::capability::{Promise, Response}; use capnp::Error; use capnp_rpc::{ - auto_reconnect, lazy_auto_reconnect, new_client, new_deferred_client, pry, rpc_twoparty_capnp, + auto_reconnect, lazy_auto_reconnect, new_client, new_future_client, pry, rpc_twoparty_capnp, twoparty, RpcSystem, }; use futures::channel::oneshot; @@ -314,7 +314,7 @@ fn auto_reconnect_rpc_call() { do_autoconnect_test(&mut pool, |c| { b.set_interface(c); let req = client.test_interface_request(); - new_deferred_client(req.send().promise.map(|resp| match resp { + new_future_client(req.send().promise.map(|resp| match resp { Ok(resp) => Ok(resp.get()?.get_cap()?), Err(err) => Err(err), })) diff --git a/capnp-rpc/test/test.rs b/capnp-rpc/test/test.rs index a6c203707..31ff15d41 100644 --- a/capnp-rpc/test/test.rs +++ b/capnp-rpc/test/test.rs @@ -605,7 +605,7 @@ fn promise_resolve() { let (paf_fulfiller, paf_promise) = oneshot::channel(); let cap: crate::test_capnp::test_interface::Client = - ::capnp_rpc::new_deferred_client(paf_promise.map_err(canceled_to_error)); + ::capnp_rpc::new_future_client(paf_promise.map_err(canceled_to_error)); request.get().set_cap(cap.clone()); request2.get().set_cap(cap); @@ -813,7 +813,7 @@ fn dont_hold() { let (fulfiller, promise) = oneshot::channel(); let cap: crate::test_capnp::test_interface::Client = - ::capnp_rpc::new_deferred_client(promise.map_err(canceled_to_error)); + ::capnp_rpc::new_future_client(promise.map_err(canceled_to_error)); let mut request = client.dont_hold_request(); request.get().set_cap(cap.clone()); @@ -911,7 +911,7 @@ fn embargo_error() { let (fulfiller, promise) = oneshot::channel(); let cap: crate::test_capnp::test_call_order::Client = - ::capnp_rpc::new_deferred_client(promise.map_err(canceled_to_error)); + ::capnp_rpc::new_future_client(promise.map_err(canceled_to_error)); let client2: crate::test_capnp::test_call_order::Client = client.clone().cast_to(); let early_call = client2.get_call_sequence_request().send(); @@ -956,7 +956,7 @@ fn echo_destruction() { let (fulfiller, promise) = oneshot::channel(); let cap: crate::test_capnp::test_call_order::Client = - ::capnp_rpc::new_deferred_client(promise.map_err(canceled_to_error)); + ::capnp_rpc::new_future_client(promise.map_err(canceled_to_error)); let client2: crate::test_capnp::test_call_order::Client = client.clone().cast_to(); let early_call = client2.get_call_sequence_request().send(); @@ -1102,13 +1102,13 @@ fn capability_server_set() { // Also works if the client is a promise. let (fulfiller, promise) = oneshot::channel(); let client_promise: test_interface::Client = - ::capnp_rpc::new_deferred_client(promise.map_err(canceled_to_error)); + ::capnp_rpc::new_future_client(promise.map_err(canceled_to_error)); let client_promise2: test_interface::Client = client_promise.clone(); let (error_fulfiller, error_promise) = oneshot::channel(); let error_promise: test_interface::Client = - ::capnp_rpc::new_deferred_client(error_promise.map_err(canceled_to_error)); + ::capnp_rpc::new_future_client(error_promise.map_err(canceled_to_error)); assert!(fulfiller.send(client1).is_ok()); let own_server1_again2 =