pub trait AsHandleRef {
    // Required method
    fn as_handle_ref(&self) -> Unowned<'_, Handle>;

    // Provided methods
    fn raw_handle(&self) -> u32 { ... }
    fn signal_handle(
        &self,
        clear_mask: Signals,
        set_mask: Signals
    ) -> Result<(), Status> { ... }
    fn wait_handle(
        &self,
        signals: Signals,
        deadline: Time
    ) -> Result<Signals, Status> { ... }
    fn wait_async_handle(
        &self,
        port: &Port,
        key: u64,
        signals: Signals,
        options: WaitAsyncOpts
    ) -> Result<(), Status> { ... }
    fn get_name(&self) -> Result<CString, Status> { ... }
    fn set_name(&self, name: &CStr) -> Result<(), Status> { ... }
    fn basic_info(&self) -> Result<HandleBasicInfo, Status> { ... }
    fn count_info(&self) -> Result<HandleCountInfo, Status> { ... }
    fn get_koid(&self) -> Result<Koid, Status> { ... }
}
Expand description

A trait to get a reference to the underlying handle of an object.

Required Methods§

fn as_handle_ref(&self) -> Unowned<'_, Handle>

Get a reference to the handle. One important use of such a reference is for object_wait_many.

Provided Methods§

fn raw_handle(&self) -> u32

Interpret the reference as a raw handle (an integer type). Two distinct handles will have different raw values (so it can perhaps be used as a key in a data structure).

fn signal_handle( &self, clear_mask: Signals, set_mask: Signals ) -> Result<(), Status>

Set and clear userspace-accessible signal bits on an object. Wraps the zx_object_signal syscall.

fn wait_handle( &self, signals: Signals, deadline: Time ) -> Result<Signals, Status>

Waits on a handle. Wraps the zx_object_wait_one syscall.

fn wait_async_handle( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts ) -> Result<(), Status>

Causes packet delivery on the given port when the object changes state and matches signals. zx_object_wait_async syscall.

fn get_name(&self) -> Result<CString, 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.

fn set_name(&self, name: &CStr) -> 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.

fn basic_info(&self) -> Result<HandleBasicInfo, Status>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_BASIC topic.

fn count_info(&self) -> Result<HandleCountInfo, Status>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_COUNT topic.

fn get_koid(&self) -> Result<Koid, Status>

Returns the koid (kernel object ID) for this handle.

Implementations on Foreign Types§

§

impl<H> AsHandleRef for OnSignals<'_, H>
where H: AsHandleRef,

§

fn as_handle_ref(&self) -> Unowned<'_, Handle>

§

impl<R, W> AsHandleRef for Fifo<R, W>

§

fn as_handle_ref(&self) -> Unowned<'_, Handle>

§

impl<T> AsHandleRef for &T
where T: AsHandleRef,

§

fn as_handle_ref(&self) -> Unowned<'_, Handle>

Implementors§

§

impl AsHandleRef for fidl::handle::AsyncChannel

§

impl AsHandleRef for fidl::handle::AsyncSocket

source§

impl AsHandleRef for fidl::handle::fuchsia_handles::Bti

§

impl AsHandleRef for fidl::handle::fuchsia_handles::Channel

§

impl AsHandleRef for Clock

§

impl AsHandleRef for DebugLog

§

impl AsHandleRef for Event

§

impl AsHandleRef for EventPair

source§

impl AsHandleRef for fidl::handle::fuchsia_handles::Exception

§

impl AsHandleRef for fidl::handle::fuchsia_handles::Fifo

§

impl AsHandleRef for Guest

§

impl AsHandleRef for Handle

§

impl AsHandleRef for Interrupt

source§

impl AsHandleRef for fidl::handle::fuchsia_handles::Iommu

§

impl AsHandleRef for Job

source§

impl AsHandleRef for Msi

source§

impl AsHandleRef for fidl::handle::fuchsia_handles::Pager

source§

impl AsHandleRef for PciDevice

source§

impl AsHandleRef for fidl::handle::fuchsia_handles::Pmt

§

impl AsHandleRef for Port

§

impl AsHandleRef for Process

§

impl AsHandleRef for Profile

§

impl AsHandleRef for Resource

§

impl AsHandleRef for fidl::handle::fuchsia_handles::Socket

§

impl AsHandleRef for Stream

source§

impl AsHandleRef for SuspendToken

§

impl AsHandleRef for Thread

§

impl AsHandleRef for Timer

§

impl AsHandleRef for Vcpu

§

impl AsHandleRef for Vmar

§

impl AsHandleRef for Vmo

§

impl AsHandleRef for Bti

§

impl AsHandleRef for Exception

§

impl AsHandleRef for Iommu

§

impl AsHandleRef for Pager

§

impl AsHandleRef for Pmt

§

impl<'a, T> AsHandleRef for Unowned<'a, T>
where T: HandleBased,

source§

impl<T> AsHandleRef for ClientEnd<T>

source§

impl<T> AsHandleRef for ServerEnd<T>