pub struct Handle(/* private fields */);Expand description
An owned and valid Zircon handle to a kernel object.
This type can be interconverted to and from more specific types. Those conversions are not enforced in the type system; attempting to use them will result in errors returned by the kernel. These conversions don’t change the underlying representation, but do change the type and what operations are available.
§Lifecycle
This type closes the handle it owns when dropped.
§Layout
Option<Handle> is guaranteed to have the same layout and bit patterns as zx_handle_t.
Unlike many types in this crate it does not implement zerocopy traits because those are not
appropriate for types with real Drop implementations.
Implementations§
Source§impl Handle
impl Handle
Sourcepub unsafe fn from_raw(raw: zx_handle_t) -> Self
pub unsafe fn from_raw(raw: zx_handle_t) -> Self
Sourcepub fn check_raw_valid(raw: zx_handle_t) -> Result<(), Status>
pub fn check_raw_valid(raw: zx_handle_t) -> Result<(), Status>
Wraps the zx_handle_check_valid syscall.
Note that this does not guarantee that the handle is safe to pass to Handle::from_raw
in cases where another function may close the handle.
Sourcepub const fn raw_handle(&self) -> zx_handle_t
pub const fn raw_handle(&self) -> zx_handle_t
Returns the raw handle’s integer value.
Sourcepub const fn into_raw(self) -> zx_handle_t
pub const fn into_raw(self) -> zx_handle_t
Return the raw handle’s integer value without closing it when self is dropped.