pub struct Channel<TX, RX> { /* private fields */ }
Expand description
One endpoint of a bi-directional inter-process communication channel,
capable of sending/receiving both raw bytes and UNIX file descriptors,
encoded/decoded from/to the TX
/RX
types, with an ordering guarantee
(messages will be received in the same order that they were sent).
Implementations§
Source§impl<TX, RX> Channel<TX, RX>
impl<TX, RX> Channel<TX, RX>
pub fn send<const TX_BYTE_LEN: usize, const TX_FD_LEN: usize>(
&self,
msg: TX,
) -> Result<(), Error>where
TX: FixedSizeEncoding<TX_BYTE_LEN, TX_FD_LEN>,
pub fn recv<const RX_BYTE_LEN: usize, const RX_FD_LEN: usize>(
&self,
) -> Result<RX, Error>where
RX: FixedSizeEncoding<RX_BYTE_LEN, RX_FD_LEN>,
Sourcepub fn into_child_process_inheritable(
self,
) -> Result<InheritableChannel<TX, RX>, Error>
pub fn into_child_process_inheritable( self, ) -> Result<InheritableChannel<TX, RX>, Error>
Enable child process inheritance (see InheritableChannel
),
i.e. remove the CLOEXEC
flag (via dup
, not fcntl(F_{SET,GET}FD)
,
due to the latter’s misdesign as read/write instead of fetch_{and,or}
,
so they invite race conditions and should be deprecated and never used).
Trait Implementations§
Auto Trait Implementations§
impl<TX, RX> Freeze for Channel<TX, RX>
impl<TX, RX> RefUnwindSafe for Channel<TX, RX>
impl<TX, RX> Send for Channel<TX, RX>
impl<TX, RX> Sync for Channel<TX, RX>
impl<TX, RX> Unpin for Channel<TX, RX>
impl<TX, RX> UnwindSafe for Channel<TX, RX>
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