pub struct Fd { /* private fields */ }Expand description
A file descriptor that can be sent across a vox connection.
Construct one with Fd::new from anything that owns a descriptor
(OwnedFd, File, UnixStream, …). After the value has been
received on the far side, take ownership with Fd::into_owned_fd
or borrow it with Fd::as_raw_fd.
Serializing an Fd duplicates its descriptor into the transport’s
SCM_RIGHTS batch (the source Fd keeps ownership), so a response
may be encoded more than once — the operation store’s replay-seal
pass and the wire pass — and the encoder’s size/write double-call is
deduped by the Fd value’s address.
Implementations§
Source§impl Fd
impl Fd
Sourcepub fn as_raw_fd(&self) -> Option<RawFd>
pub fn as_raw_fd(&self) -> Option<RawFd>
Borrow the raw descriptor without taking ownership. None if it
has already been taken.
Sourcepub fn into_owned_fd(self) -> Option<OwnedFd>
pub fn into_owned_fd(self) -> Option<OwnedFd>
Take the owned descriptor out of this Fd.
Sourcepub fn into_raw_fd(self) -> Option<RawFd>
pub fn into_raw_fd(self) -> Option<RawFd>
Take the descriptor as a raw, owned RawFd. The caller is
responsible for closing it.