#[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 -1, which in BorrowedHandle always
represents a valid handle value, such as the current process handle, and
not INVALID_HANDLE_VALUE, despite the two having the same 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.
This type’s .to_owned() implementation returns another BorrowedHandle
rather than an OwnedHandle. It just makes a trivial copy of the raw
handle, which is then borrowed under the same lifetime.
Implementations
impl BorrowedHandle<'_>
source
impl BorrowedHandle<'_>
sourcepub const unsafe fn borrow_raw(handle: RawHandle) -> Self
source
pub const unsafe fn borrow_raw(handle: RawHandle) -> Self
sourceReturn 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
impl AsHandle for BorrowedHandle<'_>
source
impl AsHandle for BorrowedHandle<'_>
sourceimpl AsRawHandle for BorrowedHandle<'_>
source
impl AsRawHandle for BorrowedHandle<'_>
sourcefn as_raw_handle(&self) -> RawHandle
source
fn as_raw_handle(&self) -> RawHandle
sourceExtracts the raw handle. Read more
impl<'handle> Clone for BorrowedHandle<'handle>
source
impl<'handle> Clone for BorrowedHandle<'handle>
sourcefn clone(&self) -> BorrowedHandle<'handle>
source
fn clone(&self) -> BorrowedHandle<'handle>
sourceReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0 · source
fn clone_from(&mut self, source: &Self)
1.0.0 · sourcePerforms copy-assignment from source. Read more
impl Debug for BorrowedHandle<'_>
source
impl Debug for BorrowedHandle<'_>
sourceimpl<'handle> Copy for BorrowedHandle<'handle>
sourceimpl Send for BorrowedHandle<'_>
sourceimpl Sync for BorrowedHandle<'_>
sourceAuto Trait Implementations
impl<'handle> RefUnwindSafe for BorrowedHandle<'handle>
impl<'handle> Unpin for BorrowedHandle<'handle>
impl<'handle> UnwindSafe for BorrowedHandle<'handle>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
source
impl<T> BorrowMut<T> for T where
T: ?Sized,
sourcefn borrow_mut(&mut self) -> &mut T
const: unstable · source
fn borrow_mut(&mut self) -> &mut T
const: unstable · sourceMutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
source
impl<T> ToOwned for T where
T: Clone,
sourcetype Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
source
fn clone_into(&self, target: &mut T)
sourceUses borrowed data to replace owned data, usually by cloning. Read more