Struct Handle
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§
§impl Handle
impl Handle
pub fn check_raw_valid(raw: u32) -> Result<(), Status>
pub fn check_raw_valid(raw: u32) -> 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.
pub const fn raw_handle(&self) -> u32
pub const fn raw_handle(&self) -> u32
Returns the raw handle’s integer value.
pub fn into_raw(self) -> u32
pub fn into_raw(self) -> u32
Return the raw handle’s integer value without closing it when self is dropped.
pub fn duplicate(&self, rights: Rights) -> Result<Handle, Status>
pub fn duplicate(&self, rights: Rights) -> Result<Handle, Status>
Wraps the
zx_handle_duplicate
syscall.
pub fn signal(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
pub fn signal( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
Wraps the zx_object_signal syscall.
pub fn wait_one(
&self,
signals: Signals,
deadline: Instant<MonotonicTimeline>,
) -> WaitResult
pub fn wait_one( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> WaitResult
Wraps the zx_object_wait_one
syscall.
pub fn wait_async(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts,
) -> Result<(), Status>
pub fn wait_async( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
Wraps the zx_object_wait_async syscall.
pub fn get_name(&self) -> Result<Name, Status>
pub fn get_name(&self) -> Result<Name, Status>
Get the Property::NAME property for this object.
Wraps a call to the
zx_object_get_property
syscall for the ZX_PROP_NAME property.
pub fn set_name(&self, name: &Name) -> Result<(), Status>
pub fn set_name(&self, name: &Name) -> Result<(), Status>
Set the Property::NAME property for this object.
The name’s length must be less than sys::ZX_MAX_NAME_LEN, i.e. name.to_bytes_with_nul().len() <= sys::ZX_MAX_NAME_LEN, or Err(Status::INVALID_ARGS) will be returned.
Wraps a call to the
zx_object_get_property
syscall for the ZX_PROP_NAME property.
pub fn basic_info(&self) -> Result<HandleBasicInfo, Status>
pub fn basic_info(&self) -> Result<HandleBasicInfo, Status>
Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_BASIC topic.
pub fn count_info(&self) -> Result<HandleCountInfo, Status>
pub fn count_info(&self) -> Result<HandleCountInfo, Status>
Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_COUNT topic.
Trait Implementations§
§impl Ord for Handle
impl Ord for Handle
§impl PartialOrd for Handle
impl PartialOrd for Handle
impl Eq for Handle
impl StructuralPartialEq for Handle
Auto Trait Implementations§
impl Freeze for Handle
impl RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnwindSafe for Handle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
Source§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to Self