pub struct OwnedHandle { /* private fields */ }
Expand description
OwnedHandle
allows managing the lifetime of the platform RawFileDescriptor
type. It is exposed in the interface of this crate primarily for convenience
on Windows where the system handle type is used for a variety of objects
that don’t support reading and writing.
Implementations§
Source§impl OwnedHandle
impl OwnedHandle
Sourcepub fn new<F: IntoRawFileDescriptor>(f: F) -> Self
pub fn new<F: IntoRawFileDescriptor>(f: F) -> Self
Create a new handle from some object that is convertible into
the system RawFileDescriptor
type. This consumes the parameter
and replaces it with an OwnedHandle
instance.
Sourcepub fn try_clone(&self) -> Result<Self>
pub fn try_clone(&self) -> Result<Self>
Attempt to duplicate the underlying handle and return an
OwnedHandle
wrapped around the duplicate. Since the duplication
requires kernel resources that may not be available, this is a
potentially fallible operation.
The returned handle has a separate lifetime from the source, but
references the same object at the kernel level.
Sourcepub fn dup<F: AsRawFileDescriptor>(f: &F) -> Result<Self>
pub fn dup<F: AsRawFileDescriptor>(f: &F) -> Result<Self>
Attempt to duplicate the underlying handle from an object that is
representable as the system RawFileDescriptor
type and return an
OwnedHandle
wrapped around the duplicate. Since the duplication
requires kernel resources that may not be available, this is a
potentially fallible operation.
The returned handle has a separate lifetime from the source, but
references the same object at the kernel level.
Trait Implementations§
Source§impl AsFd for OwnedHandle
impl AsFd for OwnedHandle
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Source§impl AsRawFd for OwnedHandle
impl AsRawFd for OwnedHandle
Source§impl Debug for OwnedHandle
impl Debug for OwnedHandle
Source§impl Drop for OwnedHandle
impl Drop for OwnedHandle
Source§impl FromRawFd for OwnedHandle
impl FromRawFd for OwnedHandle
Source§unsafe fn from_raw_fd(fd: RawFd) -> Self
unsafe fn from_raw_fd(fd: RawFd) -> Self
Self
from the given raw file
descriptor. Read more