#[repr(transparent)]pub struct HandleOrNull(_);
FFI type for handles in return values or out parameters, where
NULL is used
as a sentry value to indicate errors, such as in the return value of
CreateThread. This uses
repr(transparent) and has the representation of a host handle, so that it can be used in such
The only thing you can usefully do with a
HandleOrNull is to convert it into an
OwnedHandle using its
TryFrom implementation; this conversion takes care of the check for
NULL. This ensures that such FFI calls cannot start using the handle without
This type may hold any handle value that
OwnedHandle may hold. As with
-1, that value is interpreted as a valid handle value, such as
the current process handle, and not
If this holds a non-null handle, it will close the handle on drop.
Constructs a new instance of
Self from the given
from a Windows API that uses null to indicate failure, such as
HandleOrInvalid instead of
HandleOrNull for APIs that
INVALID_HANDLE_VALUE to indicate failure.
Auto Trait Implementations§
Returns the argument unchanged.