Trait sendfd::RecvWithFd
source · [−]pub trait RecvWithFd {
fn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>;
}
Expand description
An extension trait that enables receiving associated file descriptors along with the data.
Required Methods
Implementations on Foreign Types
sourceimpl RecvWithFd for UnixStream
impl RecvWithFd for UnixStream
sourcefn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
fn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
Receive the bytes and the file descriptors from the stream.
It is not guaranteed that the received information will form a single coherent packet of
data. In other words, it is not required that this receives the bytes and file descriptors
that were sent with a single send_with_fd
call by somebody else.
sourceimpl RecvWithFd for UnixStream
Available on crate feature tokio
only.
impl RecvWithFd for UnixStream
tokio
only.sourcefn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
fn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
Receive the bytes and the file descriptors from the stream.
It is not guaranteed that the received information will form a single coherent packet of
data. In other words, it is not required that this receives the bytes and file descriptors
that were sent with a single send_with_fd
call by somebody else.
sourceimpl RecvWithFd for ReadHalf<'_>
Available on crate feature tokio
only.
impl RecvWithFd for ReadHalf<'_>
tokio
only.sourcefn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
fn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
Receive the bytes and the file descriptors from the stream.
It is not guaranteed that the received information will form a single coherent packet of
data. In other words, it is not required that this receives the bytes and file descriptors
that were sent with a single send_with_fd
call by somebody else.
sourceimpl RecvWithFd for UnixDatagram
impl RecvWithFd for UnixDatagram
sourcefn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
fn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
Receive the bytes and the file descriptors as a single packet.
It is guaranteed that the received information will form a single coherent packet, and data
received will match a corresponding send_with_fd
call. Note, however, that in case the
receiving buffer(s) are to small, the message may get silently truncated and the
undelivered data will be discarded.
For receiving the file descriptors, the internal buffer is sized according to the size of
the fds
buffer. If the sender sends fds.len()
descriptors, but prefaces the descriptors
with some other ancilliary data, then some file descriptors may be truncated as well.
sourceimpl RecvWithFd for UnixDatagram
Available on crate feature tokio
only.
impl RecvWithFd for UnixDatagram
tokio
only.sourcefn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
fn recv_with_fd(
&self,
bytes: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
Receive the bytes and the file descriptors as a single packet.
It is guaranteed that the received information will form a single coherent packet, and data
received will match a corresponding send_with_fd
call. Note, however, that in case the
receiving buffer(s) are to small, the message may get silently truncated and the
undelivered data will be discarded.
For receiving the file descriptors, the internal buffer is sized according to the size of
the fds
buffer. If the sender sends fds.len()
descriptors, but prefaces the descriptors
with some other ancilliary data, then some file descriptors may be truncated as well.