[−][src]Struct ipc_channel::ipc::IpcOneShotServer
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]);
Methods
impl<T> IpcOneShotServer<T> where
T: for<'de> Deserialize<'de> + Serialize,
[src]
T: for<'de> Deserialize<'de> + Serialize,
pub fn new() -> Result<(IpcOneShotServer<T>, String), Error>
[src]
pub fn accept(self) -> Result<(IpcReceiver<T>, T), Error>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for IpcOneShotServer<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for IpcOneShotServer<T> where
T: Send,
T: Send,
impl<T> Sync for IpcOneShotServer<T> where
T: Sync,
T: Sync,
impl<T> Unpin for IpcOneShotServer<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for IpcOneShotServer<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,