Struct io_lifetimes::OwnedHandle
source · [−]pub struct OwnedHandle { /* private fields */ }
Expand description
An owned handle.
This closes the handle on drop.
Note that it may have the value INVALID_HANDLE_VALUE
(-1), which is
sometimes a valid handle value. See here for the full story.
And, it may have the value NULL
(0), which can occur when consoles are
detached from processes, or when windows_subsystem
is used.
OwnedHandle
uses CloseHandle
to close its handle on drop. As such,
it must not be used with handles to open registry keys which need to be
closed with RegCloseKey
instead.
Implementations
sourceimpl OwnedHandle
impl OwnedHandle
sourcepub fn try_clone(&self) -> Result<OwnedHandle>
pub fn try_clone(&self) -> Result<OwnedHandle>
Creates a new OwnedHandle
instance that shares the same underlying file handle
as the existing OwnedHandle
instance.
Trait Implementations
sourceimpl AsHandle for OwnedHandle
impl AsHandle for OwnedHandle
sourcefn as_handle(&self) -> BorrowedHandle<'_>
fn as_handle(&self) -> BorrowedHandle<'_>
Borrows the handle. Read more
sourceimpl AsRawHandle for OwnedHandle
impl AsRawHandle for OwnedHandle
sourcefn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
Extracts the raw handle, without taking any ownership.
sourceimpl Debug for OwnedHandle
impl Debug for OwnedHandle
sourceimpl Drop for OwnedHandle
impl Drop for OwnedHandle
sourceimpl FromHandle for OwnedHandle
impl FromHandle for OwnedHandle
sourcefn from_handle(owned: OwnedHandle) -> Self
fn from_handle(owned: OwnedHandle) -> Self
Constructs a new instance of Self
from the given handle. Read more
sourcefn from_into_handle<Owned: IntoHandle>(into_owned: Owned) -> Self where
Self: Sized,
fn from_into_handle<Owned: IntoHandle>(into_owned: Owned) -> Self where
Self: Sized,
Constructs a new instance of Self
from the given handle converted
from into_owned
. Read more
sourceimpl FromRawHandle for OwnedHandle
impl FromRawHandle for OwnedHandle
sourceunsafe fn from_raw_handle(handle: RawHandle) -> Self
unsafe fn from_raw_handle(handle: RawHandle) -> Self
Constructs a new instance of Self
from the given raw handle.
Safety
The resource pointed to by raw
must be open and suitable for assuming
ownership.
sourceimpl IntoHandle for OwnedHandle
impl IntoHandle for OwnedHandle
sourcefn into_handle(self) -> OwnedHandle
fn into_handle(self) -> OwnedHandle
Consumes this object, returning the underlying handle. Read more
sourceimpl IntoRawHandle for OwnedHandle
impl IntoRawHandle for OwnedHandle
sourcefn into_raw_handle(self) -> RawHandle
fn into_raw_handle(self) -> RawHandle
Consumes this object, returning the raw underlying handle. Read more
sourceimpl TryFrom<HandleOrInvalid> for OwnedHandle
impl TryFrom<HandleOrInvalid> for OwnedHandle
impl Send for OwnedHandle
impl Sync for OwnedHandle
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> AsRawFilelike for T where
T: AsRawHandle,
impl<T> AsRawFilelike for T where
T: AsRawHandle,
sourcefn as_raw_filelike(&self) -> RawFilelike
fn as_raw_filelike(&self) -> RawFilelike
Returns the raw value.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromRawFilelike for T where
T: FromRawHandle,
impl<T> FromRawFilelike for T where
T: FromRawHandle,
sourceunsafe fn from_raw_filelike(raw: RawFilelike) -> Self
unsafe fn from_raw_filelike(raw: RawFilelike) -> Self
Constructs Self
from the raw value.
sourceimpl<T> IntoRawFilelike for T where
T: IntoRawHandle,
impl<T> IntoRawFilelike for T where
T: IntoRawHandle,
sourcefn into_raw_filelike(self) -> RawFilelike
fn into_raw_filelike(self) -> RawFilelike
Returns the raw value.