pub struct IpcOneShotServer<T> { /* private fields */ }
Expand description
A server associated with a given name.
§Examples
§Basic Usage
use ipc_channel::ipc::{self, IpcOneShotServer, IpcSender, IpcReceiver};
let (server, server_name) = IpcOneShotServer::new().unwrap();
let tx: IpcSender<Vec<u8>> = IpcSender::connect(server_name).unwrap();
tx.send(vec![0x10, 0x11, 0x12, 0x13]).unwrap();
let (_, data): (_, Vec<u8>) = server.accept().unwrap();
assert_eq!(data, vec![0x10, 0x11, 0x12, 0x13]);
§Sending an IpcSender
use ipc_channel::ipc::{self, IpcOneShotServer, IpcSender, IpcReceiver};
let (server, name) = IpcOneShotServer::new().unwrap();
let (tx1, rx1): (IpcSender<Vec<u8>>, IpcReceiver<Vec<u8>>) = ipc::channel().unwrap();
let tx0 = IpcSender::connect(name).unwrap();
tx0.send(tx1).unwrap();
let (_, tx1): (_, IpcSender<Vec<u8>>) = server.accept().unwrap();
tx1.send(vec![0x48, 0x65, 0x6b, 0x6b, 0x6f, 0x00]).unwrap();
let data = rx1.recv().unwrap();
assert_eq!(data, vec![0x48, 0x65, 0x6b, 0x6b, 0x6f, 0x00]);
Implementations§
source§impl<T> IpcOneShotServer<T>where
T: for<'de> Deserialize<'de> + Serialize,
impl<T> IpcOneShotServer<T>where
T: for<'de> Deserialize<'de> + Serialize,
Auto Trait Implementations§
impl<T> !Freeze for IpcOneShotServer<T>
impl<T> !RefUnwindSafe for IpcOneShotServer<T>
impl<T> Send for IpcOneShotServer<T>where
T: Send,
impl<T> !Sync for IpcOneShotServer<T>
impl<T> Unpin for IpcOneShotServer<T>where
T: Unpin,
impl<T> UnwindSafe for IpcOneShotServer<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more