Struct BorrowedHandle
struct BorrowedHandle<'handle> { ... }
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<'_>
fn try_clone_to_owned(self: &Self) -> Result<OwnedHandle>Creates a new
OwnedHandleinstance that shares the same underlying object as the existingBorrowedHandleinstance.
impl BorrowedHandle<'_>
unsafe const fn borrow_raw(handle: RawHandle) -> SelfReturns a
BorrowedHandleholding the given raw handle.Safety
The resource pointed to by
handlemust be a valid open handle, it must remain open for the duration of the returnedBorrowedHandle.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 whenwindows_subsystemis used.
impl AsHandle for BorrowedHandle<'_>
fn as_handle(self: &Self) -> BorrowedHandle<'_>
impl AsRawHandle for BorrowedHandle<'_>
fn as_raw_handle(self: &Self) -> RawHandle
impl Debug for BorrowedHandle<'_>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl IsTerminal for BorrowedHandle<'_>
fn is_terminal(self: &Self) -> bool
impl Send for BorrowedHandle<'_>
impl Sync for BorrowedHandle<'_>
impl<'handle> Clone for BorrowedHandle<'handle>
fn clone(self: &Self) -> BorrowedHandle<'handle>
impl<'handle> Copy for BorrowedHandle<'handle>
impl<'handle> Freeze for BorrowedHandle<'handle>
impl<'handle> RefUnwindSafe for BorrowedHandle<'handle>
impl<'handle> Unpin for BorrowedHandle<'handle>
impl<'handle> UnsafeUnpin for BorrowedHandle<'handle>
impl<'handle> UnwindSafe for BorrowedHandle<'handle>
impl<T> Any for BorrowedHandle<'handle>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for BorrowedHandle<'handle>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for BorrowedHandle<'handle>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for BorrowedHandle<'handle>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for BorrowedHandle<'handle>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for BorrowedHandle<'handle>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for BorrowedHandle<'handle>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for BorrowedHandle<'handle>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for BorrowedHandle<'handle>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>