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.