#[repr(transparent)]
pub struct OwnedHandle { /* private fields */ }
🔬 This is a nightly-only experimental API. (io_safety #87074)
This is supported on Windows only.
Expand description

An owned handle.

This closes the handle on drop.

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.

OwnedHandle uses CloseHandle to close its handle on drop. As such, it must not be used with handles to open registry keys which need to be closed with RegCloseKey instead.

Implementations

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

Creates a new OwnedHandle instance that shares the same underlying file handle as the existing OwnedHandle instance.

Trait Implementations

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

Borrows the handle. Read more

Extracts the raw handle. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Constructs a new I/O object from the specified raw handle. Read more

Consumes this object, returning the raw underlying handle. 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.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.