Trait magenta::HandleBase [] [src]

pub trait HandleBase: Sized {
    fn get_ref(&self) -> HandleRef;
    fn from_handle(handle: Handle) -> Self;

    fn raw_handle(&self) -> mx_handle_t { ... }
    fn duplicate(&self, rights: Rights) -> Result<Self, Status> { ... }
    fn replace(self, rights: Rights) -> Result<Self, Status> { ... }
    fn signal(
        &self,
        clear_mask: Signals,
        set_mask: Signals
    ) -> Result<(), Status> { ... } fn wait(
        &self,
        signals: Signals,
        deadline: mx_time_t
    ) -> Result<Signals, Status> { ... } fn wait_async(
        &self,
        port: &Port,
        key: u64,
        signals: Signals,
        options: WaitAsyncOpts
    ) -> Result<(), Status> { ... } fn into_handle(self) -> Handle { ... } }

A trait implemented by all handle objects.

Note: it is reasonable for user-defined objects wrapping a handle to implement this trait. For example, a specific interface in some protocol might be represented as a newtype of Channel, and implement the get_ref and from_handle methods to facilitate conversion from and to the interface.

Required Methods

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

A method for converting an untyped Handle into a more specific reference.

Provided Methods

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).

Duplicate a handle, possibly reducing the rights available. Wraps the mx_handle_duplicate syscall.

Create a replacement for a handle, possibly reducing the rights available. This invalidates the original handle. Wraps the mx_handle_replace syscall.

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

Waits on a handle. Wraps the mx_object_wait_one syscall.

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

A method for converting the object into a generic Handle.

Implementors