Enum Fd

Source
pub enum Fd {
    None(&'static Location<'static>),
    Owned(OwnedFd),
    Borrowed(RawFd),
}

Variants§

§

None(&'static Location<'static>)

§

Owned(OwnedFd)

§

Borrowed(RawFd)

Implementations§

Source§

impl Fd

Source

pub unsafe fn from_raw_fd(fd: RawFd) -> Self

§Safety

The resource pointed to by fd must be open and suitable for assuming ownership. The resource must not require any cleanup other than close.

Source

pub unsafe fn share_raw_fd(fd: RawFd) -> Self

§Safety

Given fd must not be closed as long as the created Fd is alive.

Source

pub fn close(&mut self)

Source

pub fn try_as_raw_fd(&self) -> Result<RawFd>

Source

pub fn is_readable(&self) -> Result<bool>

Source

pub fn is_writeable(&self) -> Result<bool>

Source

pub unsafe fn ioctl_ptr<T>(&self, request: c_ulong, p: *mut T) -> Result<i32>

§Safety

require p to match the request

Source

pub unsafe fn ioctl_ptrc<T>(&self, request: c_ulong, p: *const T) -> Result<i32>

§Safety

require p to match the request

Source

pub unsafe fn mmap( &self, addr: *mut c_void, len: size_t, prot: c_int, flags: c_int, offset: off_t, ) -> Result<*mut c_void>

§Safety

allocated memory must be released manually

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 From<OwnedFd> for Fd

Source§

fn from(value: OwnedFd) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Fd

§

impl RefUnwindSafe for Fd

§

impl Send for Fd

§

impl Sync for Fd

§

impl Unpin 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.