Struct std::os::windows::io::handle::BorrowedHandle[][src]

#[repr(transparent)]
pub struct BorrowedHandle<'handle> { handle: NonNull<c_void>, _phantom: PhantomData<&'handle OwnedHandle>, }
🔬 This is a nightly-only experimental API. (io_safety #87074)
This is supported on Windows only.
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, 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.

Fields

handle: NonNull<c_void>
🔬 This is a nightly-only experimental API. (io_safety #87074)
_phantom: PhantomData<&'handle OwnedHandle>
🔬 This is a nightly-only experimental API. (io_safety #87074)

Implementations

🔬 This is a nightly-only experimental API. (io_safety #87074)

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

🔬 This is a nightly-only experimental API. (io_safety #87074)

Borrows the handle. Read more

Extracts the raw handle, without taking any ownership.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into #41263)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.