Struct std::os::windows::io::BorrowedHandle
#[repr(transparent)]pub struct BorrowedHandle<'handle> { /* fields omitted */ }
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, and it is never null.
Note that it may have the value INVALID_HANDLE_VALUE
(-1), which is sometimes a valid handle value. See here for the full story.
Implementations
impl BorrowedHandle<'_>
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
, and it must not be null.
Note that it may have the value INVALID_HANDLE_VALUE
(-1), which is sometimes a valid handle value. See here for the full story.
Trait Implementations
impl AsHandle for BorrowedHandle<'_>
impl AsRawHandle for BorrowedHandle<'_>
fn as_raw_handle(&self) -> RawHandle
Extracts the raw handle, without taking any ownership.
impl<'handle> Clone for BorrowedHandle<'handle>
fn clone(&self) -> BorrowedHandle<'handle>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for BorrowedHandle<'_>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the value using the given formatter. Read more
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
impl<T> From<T> for T
pub fn from(t: T) -> T
Performs the conversion.
pub fn into(self) -> U
Performs the conversion.
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
#41263)recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/windows/io/struct.BorrowedHandle.html