From 579d2b1f02bacd7e7d3dbb9061c40c6f770d8373 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 29 Mar 2016 22:29:43 +0300 Subject: [PATCH] final static functions --- ipc/codegen/src/codegen.rs | 12 ++++++++++++ ipc/tests/service.rs.in | 16 +--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ipc/codegen/src/codegen.rs b/ipc/codegen/src/codegen.rs index b6e823fde..621069cc2 100644 --- a/ipc/codegen/src/codegen.rs +++ b/ipc/codegen/src/codegen.rs @@ -431,6 +431,18 @@ fn push_proxy_implementation( let implement = quote_item!(cx, impl ServiceProxy where S: ::ipc::IpcSocket { + pub fn new(socket: S) -> ServiceProxy { + ServiceProxy { + socket: ::std::cell::RefCell::new(socket), + phantom: ::std::marker::PhantomData, + } + } + + #[cfg(test)] + pub fn socket(&self) -> &::std::cell::RefCell { + &self.socket + } + $items }).unwrap(); diff --git a/ipc/tests/service.rs.in b/ipc/tests/service.rs.in index b4545d320..9439e6508 100644 --- a/ipc/tests/service.rs.in +++ b/ipc/tests/service.rs.in @@ -36,21 +36,7 @@ impl Service { } } -impl ServiceProxy { - pub fn new(socket: S) -> ServiceProxy { - ServiceProxy { - socket: ::std::cell::RefCell::new(socket), - phantom: ::std::marker::PhantomData, - } - } - - #[cfg(test)] - pub fn socket(&self) -> &::std::cell::RefCell { - &self.socket - } -} - -impl Service { + impl Service { pub fn new() -> Service { Service { commits: RwLock::new(0usize),