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
fn get_ref(&self) -> HandleRef
Get a reference to the handle. One important use of such a reference is
for object_wait_many
.
fn from_handle(handle: Handle) -> Self
A method for converting an untyped Handle
into a more specific reference.
Provided Methods
fn raw_handle(&self) -> mx_handle_t
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 duplicate(&self, rights: Rights) -> Result<Self, Status>
Duplicate a handle, possibly reducing the rights available. Wraps the mx_handle_duplicate syscall.
fn replace(self, rights: Rights) -> Result<Self, Status>
Create a replacement for a handle, possibly reducing the rights available. This invalidates the original handle. Wraps the mx_handle_replace syscall.
fn signal(&self, clear_mask: Signals, set_mask: Signals) -> Result<(), Status>
Set and clear userspace-accessible signal bits on an object. Wraps the mx_object_signal syscall.
fn wait(&self, signals: Signals, deadline: mx_time_t) -> Result<Signals, Status>
Waits on a handle. Wraps the mx_object_wait_one syscall.
fn wait_async(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts
) -> Result<(), Status>
&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. mx_object_wait_async syscall.
fn into_handle(self) -> Handle
A method for converting the object into a generic Handle.
Implementors
impl HandleBase for Channel
impl HandleBase for Event
impl HandleBase for EventPair
impl HandleBase for Fifo
impl HandleBase for Job
impl HandleBase for Port
impl HandleBase for Process
impl HandleBase for Socket
impl HandleBase for Timer
impl HandleBase for Thread
impl HandleBase for Vmo
impl HandleBase for Handle