Trait magenta::HandleBased
[−]
[src]
pub trait HandleBased: AsHandleRef + From<Handle> + Into<Handle> { fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status> { ... } fn replace_handle(self, rights: Rights) -> Result<Self, Status> { ... } }
A trait implemented by all handle-based types.
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 as_handle_ref
method and the From<Handle>
trait to facilitate conversion from and to the
interface.
Provided Methods
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
Duplicate a handle, possibly reducing the rights available. Wraps the mx_handle_duplicate syscall.
fn replace_handle(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.
Implementors
impl HandleBased for Channel
impl HandleBased for Event
impl HandleBased for EventPair
impl HandleBased for Fifo
impl HandleBased for Job
impl HandleBased for Port
impl HandleBased for Process
impl HandleBased for Socket
impl HandleBased for Timer
impl HandleBased for Thread
impl HandleBased for Vmo
impl HandleBased for Handle