Enum unshare::Fd[][src]

pub enum Fd {
    ReadPipe,
    WritePipe,
    Inherit,
    ReadNull,
    WriteNull,
    Fd(Closing),
}

An enumeration that is used to configure non-stdio file descriptors. It differs from stdio one because we must differentiate from readable and writable file descriptors for things open by the library

The enumeration members might be non-stable, it’s better to use one of the constructors to create an instance

Variants

ReadPipe

This fd is a reading end of a pipe

WritePipe

This fd is a writing end of a pipe

Inherit

This fd is inherited from parent (current) process

ReadNull

This fd is redirected from /dev/null

WriteNull

This fd is redirected to /dev/null

Fd(Closing)

This is fd passed by application (and closed by unshare)

Implementations

impl Fd[src]

pub fn piped_read() -> Fd[src]

Create a pipe so that child can read from it

pub fn piped_write() -> Fd[src]

Create a pipe so that child can write to it

pub fn inherit() -> Fd[src]

Inherit the child descriptor from parent

Not very useful for custom file descriptors better use from_file()

pub fn read_null() -> Fd[src]

Create a readable pipe that always has end of file condition

pub fn write_null() -> Fd[src]

Create a writable pipe that ignores all the input

pub fn dup_file<F: AsRawFd>(file: &F) -> Result<Fd>[src]

A simpler helper method for from_raw_fd, that does dup of file descriptor, so is actually safe to use (but can fail)

pub fn from_file<F: IntoRawFd>(file: F) -> Fd[src]

A simpler helper method for from_raw_fd, that consumes file

Auto Trait Implementations

impl RefUnwindSafe for Fd

impl Send for Fd

impl Sync for Fd

impl Unpin for Fd

impl UnwindSafe for Fd

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.