#[repr(transparent)]pub struct BorrowedHandle<'handle> { /* private fields */ }
Expand description
A borrowed handle.
This has a lifetime parameter to tie it to the lifetime of something that owns the handle.
This uses repr(transparent)
and has the representation of a host handle,
so it can be used in FFI in places where a handle is passed as an argument,
it is not captured or consumed.
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.
Implementations
sourceimpl BorrowedHandle<'_>
impl BorrowedHandle<'_>
sourcepub unsafe fn borrow_raw_handle(handle: RawHandle) -> Self
pub unsafe fn borrow_raw_handle(handle: RawHandle) -> Self
Return a BorrowedHandle
holding the given raw handle.
Safety
The resource pointed to by handle
must be a valid open handle, it
must remain open for the duration of the returned BorrowedHandle
.
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.
Trait Implementations
sourceimpl AsHandle for BorrowedHandle<'_>
impl AsHandle for BorrowedHandle<'_>
sourceimpl AsRawHandle for BorrowedHandle<'_>
impl AsRawHandle for BorrowedHandle<'_>
sourcefn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
Extracts the raw handle, without taking any ownership.
sourceimpl<'handle> Clone for BorrowedHandle<'handle>
impl<'handle> Clone for BorrowedHandle<'handle>
sourcefn clone(&self) -> BorrowedHandle<'handle>
fn clone(&self) -> BorrowedHandle<'handle>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for BorrowedHandle<'_>
impl Debug for BorrowedHandle<'_>
impl<'handle> Copy for BorrowedHandle<'handle>
impl Send for BorrowedHandle<'_>
impl Sync for BorrowedHandle<'_>
Auto Trait Implementations
impl<'handle> RefUnwindSafe for BorrowedHandle<'handle>
impl<'handle> Unpin for BorrowedHandle<'handle>
impl<'handle> UnwindSafe for BorrowedHandle<'handle>
Blanket Implementations
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