Skip to content

Commit 1f99e45

Browse files
committed
remove deprecated things associated with ServerHook
1 parent 20a60a7 commit 1f99e45

File tree

3 files changed

+1
-57
lines changed

3 files changed

+1
-57
lines changed

capnp-rpc/src/lib.rs

+1-20
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ use futures::{Future, FutureExt, TryFutureExt};
6969
use futures::channel::oneshot;
7070
use capnp::Error;
7171
use capnp::capability::Promise;
72-
use capnp::private::capability::{ClientHook, ServerHook};
72+
use capnp::private::capability::{ClientHook};
7373
use std::cell::{RefCell};
7474
use std::rc::{Rc};
7575

@@ -298,25 +298,6 @@ impl <VatId> Future for RpcSystem<VatId> where VatId: 'static {
298298
}
299299
}
300300

301-
/// Hook that allows local implementations of interfaces to be passed to the RPC system
302-
/// so that they can be called remotely.
303-
///
304-
/// To use this, you need to do the following dance:
305-
///
306-
/// ```ignore
307-
/// let client = foo::ToClient::new(FooImpl).into_client::<::capnp_rpc::Server>());
308-
/// ```
309-
#[deprecated(since="capnp-rpc-v0.12.2",
310-
note="Use capnp_rpc::new_client() instead. You may need to do `cargo update -p capnpc` too.")]
311-
pub struct Server;
312-
313-
#[allow(deprecated)]
314-
impl ServerHook for Server {
315-
fn new_client(server: Box<dyn (::capnp::capability::Server)>) -> ::capnp::capability::Client {
316-
::capnp::capability::Client::new(Box::new(local::Client::new(server)))
317-
}
318-
}
319-
320301
/// Creates a new local RPC client of type `C` out of an object that implements a server trait `S`.
321302
pub fn new_client<C, S>(s: S) -> C where C: capnp::capability::FromServer<S> {
322303
capnp::capability::FromClientHook::new(Box::new(

capnp/src/private/capability.rs

-5
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ impl Clone for Box<dyn ClientHook> {
7373
}
7474
}
7575

76-
// TODO(versionbump) remove this. It has been superseded by capnp::capability::FromServer.
77-
pub trait ServerHook: 'static {
78-
fn new_client(server: Box<dyn crate::capability::Server>) -> crate::capability::Client;
79-
}
80-
8176
pub trait ResultsHook {
8277
fn get<'a>(&'a mut self) -> crate::Result<any_pointer::Builder<'a>>;
8378
fn allow_cancellation(&self);

capnpc/src/codegen.rs

-32
Original file line numberDiff line numberDiff line change
@@ -1717,38 +1717,6 @@ fn generate_node(gen: &GeneratorContext,
17171717
Line("}".to_string())]))),
17181718
Line("}".to_string())]));
17191719

1720-
// TODO(versionbump): Remove this, as it has been superseded by capnp_rpc::new_client().
1721-
mod_interior.push(
1722-
Branch(vec!(
1723-
(if is_generic {
1724-
Branch(vec!(
1725-
Line(format!("pub struct ToClient<_U,{}> {} {{", params.params, params.where_clause)),
1726-
Indent(Box::new(Branch(vec!(
1727-
Line("pub u: _U,".to_string()),
1728-
Line(params.phantom_data_type.clone()),
1729-
)))),
1730-
Line("}".to_string()),
1731-
Line(format!("impl <{0}, _U: Server<{0}> + 'static> ToClient<_U,{0}> {1} {{",
1732-
params.params, params.where_clause_with_static)),
1733-
Indent(Box::new(Line(format!(
1734-
"pub fn new(u: _U) -> ToClient<_U, {}> {{ ToClient {{u, _phantom: ::std::marker::PhantomData}} }}",
1735-
params.params)))),
1736-
))
1737-
} else {
1738-
Branch(vec!(
1739-
Line("pub struct ToClient<_U>{pub u: _U}".to_string()),
1740-
Line("impl <_U: Server + 'static> ToClient<_U> {".to_string()),
1741-
Indent(Box::new(Line("pub fn new(u: _U) -> ToClient<_U> { ToClient {u} }".to_string()))),
1742-
))
1743-
}),
1744-
Indent(Box::new(Branch( vec!(
1745-
Line(format!("pub fn into_client<_T: ::capnp::private::capability::ServerHook>(self) -> Client{} {{", bracketed_params)),
1746-
Indent(
1747-
Box::new(Line(format!("Client {{ client: _T::new_client(::std::boxed::Box::new(ServerDispatch {{ server: ::std::boxed::Box::new(self.u), {} }})), {} }}", params.phantom_data_value, params.phantom_data_value)))),
1748-
Line("}".to_string()))))),
1749-
Line("}".to_string()))));
1750-
1751-
17521720
mod_interior.push(
17531721
Branch(vec!(
17541722
Line(format!("impl {0} ::capnp::traits::HasTypeId for Client{0} {{",

0 commit comments

Comments
 (0)