Skip to main content

Fd

Struct Fd 

Source
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

Source

pub fn new(fd: impl Into<OwnedFd>) -> Self

Wrap an owned descriptor for sending.

Source

pub fn as_raw_fd(&self) -> Option<RawFd>

Borrow the raw descriptor without taking ownership. None if it has already been taken.

Source

pub fn into_owned_fd(self) -> Option<OwnedFd>

Take the owned descriptor out of this Fd.

Source

pub fn into_raw_fd(self) -> Option<RawFd>

Take the descriptor as a raw, owned RawFd. The caller is responsible for closing it.

Trait Implementations§

Source§

impl Debug for Fd

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'ʄ> Facet<'ʄ> for Fd

Source§

const SHAPE: &'static Shape

The shape of this type, including: whether it’s a Struct, an Enum, something else? Read more
Source§

impl Send for Fd

Auto Trait Implementations§

§

impl !Freeze for Fd

§

impl !RefUnwindSafe for Fd

§

impl !Sync for Fd

§

impl Unpin for Fd

§

impl UnsafeUnpin for Fd

§

impl UnwindSafe for Fd

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> MaybeSend for T
where T: Send,