1use linux_ipc::IpcChannel;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Serialize, Deserialize)]
5struct Test {
6 pub name: String,
7 pub content: String,
8}
9
10fn main() {
11 let mut channel = IpcChannel::new("/tmp/example.sock").expect("Failed to create channel");
12
13 loop {
14 let (response, reply) = channel.receive::<Test, Test>().expect("Failed to receive post");
15 println!("Received: {:#?}", response);
16
17 let to_send = Test {
18 name: response.content,
19 content: response.name,
20 };
21
22 println!("Sending: {:#?}", to_send);
23
24 reply(to_send).expect("Failed to reply to client");
25 }
26}