pub trait Ipc: 'static + Send {
type Addr: Clone + Default + Eq + Hash + Debug;
// Required methods
fn name() -> String;
fn send(&self, msg: &[u8], to: &Self::Addr) -> Result<()>;
fn recv(&self, msg: &mut [u8]) -> Result<(usize, Self::Addr)>;
fn close(&mut self) -> Result<()>;
}
Expand description
IPC mechanisms must implement this trait.
This API enables both connection-oriented (send/recv) and connectionless (sendto/recvfrom)
sockets, but currently only unix sockets support connectionless sockets. When using unix
sockets, you must provide a valid Addr
to send()
and you will also receive a valid
Addr
as a return value from recv
. When using connection-oriented ipc mechanisms, these
values are ignored and should just be the nil value ()
.
Required Associated Types§
Required Methods§
sourcefn name() -> String
fn name() -> String
Returns the name of this IPC mechanism (e.g. “netlink” for Linux netlink sockets)