pub struct OwnedFd { /* private fields */ }
Expand description
An owned file descriptor.
This closes the file descriptor on drop.
This uses repr(transparent)
and has the representation of a host file
descriptor, so it can be used in FFI in places where a file descriptor is
passed as a consumed argument or returned as an owned value, and it never
has the value -1
.
Implementations§
Source§impl OwnedFd
impl OwnedFd
Sourcepub const unsafe fn from_raw_fd(fd: RawFd) -> Self
pub const unsafe fn from_raw_fd(fd: RawFd) -> Self
Constructs a new instance of Self
from the given raw file descriptor.
§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
.
Sourcepub fn into_raw_fd(self) -> RawFd
pub fn into_raw_fd(self) -> RawFd
Consumes this object, returning the raw underlying file descriptor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OwnedFd
impl RefUnwindSafe for OwnedFd
impl Send for OwnedFd
impl Sync for OwnedFd
impl Unpin for OwnedFd
impl UnwindSafe for OwnedFd
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more