pub trait UnixStreamExt {
// Required methods
fn send_fds(&self, data: &[u8], fds: &[impl AsFd]) -> Result<usize>;
fn recv_fds<const N: usize>(&self) -> Result<ReceivedFds>;
fn recv_fds_into<const N: usize>(
&self,
data_buf: &mut [u8],
) -> Result<(usize, Vec<OwnedFd>)>;
}Expand description
Extension trait for UnixStream adding fd-passing convenience methods.
Required Methods§
Sourcefn send_fds(&self, data: &[u8], fds: &[impl AsFd]) -> Result<usize>
fn send_fds(&self, data: &[u8], fds: &[impl AsFd]) -> Result<usize>
Send data plus borrowed file descriptors over the stream.
Caller retains ownership of the fds.
Sourcefn recv_fds<const N: usize>(&self) -> Result<ReceivedFds>
fn recv_fds<const N: usize>(&self) -> Result<ReceivedFds>
Receive data and up to N file descriptors.
Allocates an internal 4 KiB data buffer plus an oversized cmsg buffer
that prevents kernel-level fd leaks. Surplus fds beyond N are
closed automatically.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.