summaryrefslogtreecommitdiffhomepage
path: root/talpid_ipc/src
diff options
context:
space:
mode:
Diffstat (limited to 'talpid_ipc/src')
-rw-r--r--talpid_ipc/src/nop_ipc.rs2
-rw-r--r--talpid_ipc/src/zmq_ipc.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/talpid_ipc/src/nop_ipc.rs b/talpid_ipc/src/nop_ipc.rs
index f6ead2676b..8c7a24bc63 100644
--- a/talpid_ipc/src/nop_ipc.rs
+++ b/talpid_ipc/src/nop_ipc.rs
@@ -9,7 +9,7 @@ use serde;
/// We plan on trying with ZMQ again in the future.
/// Erik, 2017-02-09
pub fn start_new_server<T, F>(_on_message: F) -> Result<IpcServerId>
- where T: serde::Deserialize + 'static,
+ where for<'de> T: serde::Deserialize<'de> + 'static,
F: FnMut(Result<T>) + Send + 'static
{
bail!(ErrorKind::CouldNotStartServer);
diff --git a/talpid_ipc/src/zmq_ipc.rs b/talpid_ipc/src/zmq_ipc.rs
index 49aad9f699..35fe5e59a9 100644
--- a/talpid_ipc/src/zmq_ipc.rs
+++ b/talpid_ipc/src/zmq_ipc.rs
@@ -16,7 +16,7 @@ use std::thread;
///
/// This function is non-blocking and thus spawns a thread where it listens to messages.
pub fn start_new_server<T, F>(on_message: F) -> Result<IpcServerId>
- where T: serde::Deserialize + 'static,
+ where for<'de> T: serde::Deserialize<'de> + 'static,
F: FnMut(Result<T>) + Send + 'static
{
for port in 5000..5010 {
@@ -40,7 +40,7 @@ fn start_zmq_server(connection_string: &str) -> zmq::Result<zmq::Socket> {
}
fn start_receive_loop<T, F>(socket: zmq::Socket, mut on_message: F) -> thread::JoinHandle<()>
- where T: serde::Deserialize + 'static,
+ where for<'de> T: serde::Deserialize<'de> + 'static,
F: FnMut(Result<T>) + Send + 'static
{
thread::spawn(
@@ -54,8 +54,8 @@ fn start_receive_loop<T, F>(socket: zmq::Socket, mut on_message: F) -> thread::J
)
}
-fn parse_message<T>(message: &[u8]) -> Result<T>
- where T: serde::Deserialize + 'static
+fn parse_message<'a, T>(message: &'a [u8]) -> Result<T>
+ where T: serde::Deserialize<'a> + 'static
{
serde_json::from_slice(message).chain_err(|| ErrorKind::ParseFailure)
}