Struct std::os::windows::io::OwnedHandle [−][src]
#[repr(transparent)]pub struct OwnedHandle { /* fields omitted */ }Expand description
An owned handle.
This closes the handle on drop.
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 a consumed
argument or returned as an owned value, and 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. For APIs
like CreateFileW which report errors with INVALID_HANDLE_VALUE instead
of null, use HandleOrInvalid instead of Option<OwnedHandle>.
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.
Trait Implementations
Extracts the raw handle, without taking any ownership.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Constructs a new instance of Self from the given raw handle.
Use HandleOrInvalid instead of Option<OwnedHandle> for APIs that
use INVALID_HANDLE_VALUE to indicate failure.
Safety
The resource pointed to by handle must be open and suitable for
assuming ownership. The resource must not require any cleanup other
than CloseHandle.
In particular, it must not be used with handles to open registry
keys which need to be closed with RegCloseKey instead.
Note that it may have the value INVALID_HANDLE_VALUE (-1), which is
sometimes a valid handle value. See here for the full story.
Consumes this object, returning the raw underlying handle. Read more