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:
raw
may be closed manually and the returnedHandle
must not be dropped.- Or
raw
must not be closed until the returnedHandle
is 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
.source§fn raw_handle(&self) -> zx_handle_t
fn raw_handle(&self) -> zx_handle_t
source§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
source§fn wait_handle(
&self,
signals: Signals,
deadline: MonotonicInstant,
) -> Result<Signals, Status>
fn wait_handle( &self, signals: Signals, deadline: MonotonicInstant, ) -> Result<Signals, Status>
source§fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts,
) -> Result<(), Status>
fn wait_async_handle( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
source§fn get_name(&self) -> Result<Name, Status>
fn get_name(&self) -> Result<Name, Status>
source§fn set_name(&self, name: &Name) -> Result<(), Status>
fn set_name(&self, name: &Name) -> Result<(), Status>
source§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
source§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
source§impl HandleBased for Handle
impl HandleBased for Handle
source§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
source§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
source§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
source§fn into_raw(self) -> zx_handle_t
fn into_raw(self) -> zx_handle_t
source§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
source§fn into_handle_based<H: HandleBased>(self) -> H
fn into_handle_based<H: HandleBased>(self) -> H
source§fn from_handle_based<H: HandleBased>(h: H) -> Self
fn from_handle_based<H: HandleBased>(h: H) -> Self
fn is_invalid_handle(&self) -> bool
source§impl Ord for Handle
impl Ord for Handle
source§impl PartialEq for Handle
impl PartialEq for Handle
source§impl PartialOrd for Handle
impl PartialOrd for Handle
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more