Function ipc_channel::ipc::bytes_channel
source · pub fn bytes_channel() -> Result<(IpcBytesSender, IpcBytesReceiver), Error>
Expand description
Create a connected IpcBytesSender and IpcBytesReceiver.
Note: The IpcBytesSender transfers messages of the type [u8]
and the IpcBytesReceiver receives a Vec<u8>
. This sender/receiver
type does not serialize/deserialize messages through serde
, making
it more efficient where applicable.
§Examples
let payload = b"'Tis but a scratch!!";
// Create a channel
let (tx, rx) = ipc::bytes_channel().unwrap();
// Send data
tx.send(payload).unwrap();
// Receive the data
let response = rx.recv().unwrap();
assert_eq!(response, payload);