Trait lrs::fd::FDContainer

Objects that are file descriptor wrappers.

Syntax

trait FDContainer {
    /* Required methods */
    fn borrow(&self) -> i32
    fn from_borrowed(fd: i32) -> Self
    fn from_owned(fd: i32) -> Self
    fn is_owned(&self) -> bool
    fn unwrap(self) -> i32

    /* Provided methods */
    fn as_fdio(&self) -> FdIo
    fn description_flags(&self) -> Result<DescriptionFlags, Errno>
    fn duplicate(&self) -> Result<Self, Errno>
    fn duplicate_as(&self, new: i32) -> Result<Self, Errno>
    fn duplicate_min(&self, min: i32) -> Result<Self, Errno>
    fn is_close_on_exec(&self) -> Result<bool, Errno>
    fn set_close_on_exec(&self, val: bool) -> Result<(), Errno>
    fn set_description_flags(&self, flags: DescriptionFlags) -> Result<(), Errno>
}

Methods

ReceiverNameDescription
&selfas_fdio

Borrows the file descriptor as an FdIo.

&selfborrow

Returns the contained file descriptor.

&selfdescription_flags

Retrieves the file description flags.

&selfduplicate

Duplicates the file descriptor.

&selfduplicate_as

Duplicates the file descriptor, replacing an existing one.

&selfduplicate_min

Duplicates the file descriptor so that the duplicated one has a minimum value.

from_borrowed

Creates a new borrowed object from a file descriptor.

from_owned

Creates a new owned object from a file descriptor.

&selfis_close_on_exec

Retrieves the status of the close on exec flag.

&selfis_owned

Returns whether the object owns the file descriptor, i.e., whether it closes it when it goes out of scope.

&selfset_close_on_exec

Enables or disables the close on exec flag.

&selfset_description_flags

Sets the file description flags.

selfunwrap

Consumes the object and returns the file descriptor without closing it.