pub struct ZirconHandle(/* 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 NullableHandle
impl NullableHandle
Sourcepub const fn invalid() -> NullableHandle
pub const fn invalid() -> NullableHandle
Initialize a handle backed by ZX_HANDLE_INVALID, the only safe non-handle.
Sourcepub const unsafe fn from_raw(raw: u32) -> NullableHandle
pub const unsafe fn from_raw(raw: u32) -> NullableHandle
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 returnedNullableHandlemust not be dropped.- Or
rawmust not be closed until the returnedNullableHandleis dropped, at which time it will closeraw.
pub const fn raw_handle(&self) -> u32
pub fn into_raw(self) -> u32
pub const fn is_invalid(&self) -> bool
pub fn duplicate(&self, rights: Rights) -> Result<NullableHandle, Status>
pub fn replace(self, rights: Rights) -> Result<NullableHandle, Status>
pub fn signal( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
pub fn wait_one( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> WaitResult
pub fn wait_async( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
pub fn get_name(&self) -> Result<Name, Status>
pub fn set_name(&self, name: &Name) -> Result<(), Status>
pub fn basic_info(&self) -> Result<HandleBasicInfo, Status>
pub fn count_info(&self) -> Result<HandleCountInfo, Status>
pub fn koid(&self) -> Result<Koid, Status>
Trait Implementations§
Source§impl AsHandleRef for NullableHandle
impl AsHandleRef for NullableHandle
Source§fn as_handle_ref(&self) -> Unowned<'_, NullableHandle>
fn as_handle_ref(&self) -> Unowned<'_, NullableHandle>
object_wait_many.