[][src]Trait linux::fd::FdContainer

pub trait FdContainer: Into<c_int> {
    fn is_owned(&self) -> bool;
fn borrow(&self) -> c_int;
fn from_owned(fd: c_int) -> Self;
fn from_borrowed(fd: c_int) -> Self; fn as_fdio(&self) -> FdIo { ... }
fn is_close_on_exec(&self) -> Result<bool> { ... }
fn set_close_on_exec(&self, val: bool) -> Result { ... }
fn description_flags(&self) -> Result<DescriptionFlags> { ... }
fn set_description_flags(&self, flags: DescriptionFlags) -> Result { ... }
fn duplicate(&self) -> Result<Self>
    where
        Self: Sized
, { ... }
fn duplicate_min(&self, min: c_int) -> Result<Self>
    where
        Self: Sized
, { ... }
fn duplicate_as(&self, new: c_int) -> Result<Self>
    where
        Self: Sized
, { ... } }

Objects that are file descriptor wrappers.

Required methods

fn is_owned(&self) -> bool

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

fn borrow(&self) -> c_int

Returns the contained file descriptor.

fn from_owned(fd: c_int) -> Self

Creates a new owned object from a file descriptor.

[argument, fd] The value of the file descriptor.

= Remarks

Not all objects support owned file descriptors. Check with is_owned if this matters.

fn from_borrowed(fd: c_int) -> Self

Creates a new borrowed object from a file descriptor.

[argument, fd] The value of the file descriptor.

Loading content...

Provided methods

Important traits for FdIo
fn as_fdio(&self) -> FdIo

Borrows the file descriptor as an FdIo.

fn is_close_on_exec(&self) -> Result<bool>

Retrieves the status of the close on exec flag.

[return_value] Returns whether the close on exec flag is set.

= See also

  • link:man:fcntl(2) and the description of F_GETFD therein.
  • link:lrs::fd::FdContainer::set_close_on_exec

fn set_close_on_exec(&self, val: bool) -> Result

Enables or disables the close on exec flag.

[argument, val] Whether the flag is set.

= See also

  • link:man:fcntl(2) and the description of F_SETFD therein.
  • link:lrs::file::File::io_close_on_exec

fn description_flags(&self) -> Result<DescriptionFlags>

Retrieves the file description flags.

[return_value] Returns the description flags.

= See also

  • link:man:fcntl(2) and the description of F_GETFL therein.
  • link:lrs::fd::FdContainer::set_description_flags

fn set_description_flags(&self, flags: DescriptionFlags) -> Result

Sets the file description flags.

[argument, flags] The modified flags.

= See also

  • link:man:fcntl(2) and the description of F_SETFL therein.
  • link:lrs::fd::FdContainer::description_flags

fn duplicate(&self) -> Result<Self> where
    Self: Sized

Duplicates the file descriptor.

= Remarks

The close on exec flag will automatically be set on the new file descriptor.

= See also

  • link:lrs::fd::FdContainer::duplicate_min

fn duplicate_min(&self, min: c_int) -> Result<Self> where
    Self: Sized

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

[argument, min] The minimum value of the new file descriptor.

= Remarks

The close on exec flag will automatically be set on the new file descriptor.

= See also

  • link:lrs::fd::FdContainer::duplicate
  • link:man:fcntl(2) and F_DUPFD_CLOEXEC therein

fn duplicate_as(&self, new: c_int) -> Result<Self> where
    Self: Sized

Duplicates the file descriptor, replacing an existing one.

[argument, new] The file descriptor to replace.

= Remarks

The new argument can refer to an open file descriptor but does not have to. In this case, new will be atomically closed and replaced by a duplicate of this file descriptor.

= See also

  • link:man:dup3(2)
Loading content...

Implementors

impl FdContainer for FdIo[src]

Important traits for FdIo
fn as_fdio(&self) -> FdIo[src]

fn is_close_on_exec(&self) -> Result<bool>[src]

fn set_close_on_exec(&self, val: bool) -> Result[src]

fn description_flags(&self) -> Result<DescriptionFlags>[src]

fn set_description_flags(&self, flags: DescriptionFlags) -> Result[src]

fn duplicate(&self) -> Result<Self> where
    Self: Sized
[src]

fn duplicate_min(&self, min: c_int) -> Result<Self> where
    Self: Sized
[src]

fn duplicate_as(&self, new: c_int) -> Result<Self> where
    Self: Sized
[src]

impl FdContainer for Timer[src]

Important traits for FdIo
fn as_fdio(&self) -> FdIo[src]

fn is_close_on_exec(&self) -> Result<bool>[src]

fn set_close_on_exec(&self, val: bool) -> Result[src]

fn description_flags(&self) -> Result<DescriptionFlags>[src]

fn set_description_flags(&self, flags: DescriptionFlags) -> Result[src]

fn duplicate(&self) -> Result<Self> where
    Self: Sized
[src]

fn duplicate_min(&self, min: c_int) -> Result<Self> where
    Self: Sized
[src]

fn duplicate_as(&self, new: c_int) -> Result<Self> where
    Self: Sized
[src]

impl FdContainer for c_int[src]

Important traits for FdIo
fn as_fdio(&self) -> FdIo[src]

fn is_close_on_exec(&self) -> Result<bool>[src]

fn set_close_on_exec(&self, val: bool) -> Result[src]

fn description_flags(&self) -> Result<DescriptionFlags>[src]

fn set_description_flags(&self, flags: DescriptionFlags) -> Result[src]

fn duplicate(&self) -> Result<Self> where
    Self: Sized
[src]

fn duplicate_min(&self, min: c_int) -> Result<Self> where
    Self: Sized
[src]

fn duplicate_as(&self, new: c_int) -> Result<Self> where
    Self: Sized
[src]

Loading content...