pub struct Handle(/* private fields */);Expand description
An object representing a Zircon handle.
Internally, it is represented as a 32-bit integer, but this wrapper enforces
strict ownership semantics. The Drop implementation closes the handle.
This type represents the most general reference to a kernel object, and 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 thus what operations are available.
Implementations§
Source§impl Handle
impl Handle
Sourcepub const fn invalid() -> Handle
pub const fn invalid() -> Handle
Initialize a handle backed by ZX_HANDLE_INVALID, the only safe non-handle.
Sourcepub const unsafe fn from_raw(raw: zx_handle_t) -> Handle
pub const unsafe fn from_raw(raw: zx_handle_t) -> Handle
If a raw handle is obtained from some other source, this method converts it into a type-safe owned handle.
§Safety
raw must either be a valid handle (i.e. not dangling), or
ZX_HANDLE_INVALID. If raw is a valid handle, then either:
rawmay be closed manually and the returnedHandlemust not be dropped.- Or
rawmust not be closed until the returnedHandleis dropped, at which time it will closeraw.
pub fn is_invalid(&self) -> bool
pub fn replace(self, rights: Rights) -> Result<Handle, Status>
Trait Implementations§
Source§impl AsHandleRef for Handle
impl AsHandleRef for Handle
Source§fn as_handle_ref(&self) -> HandleRef<'_>
fn as_handle_ref(&self) -> HandleRef<'_>
object_wait_many.