fidl::handle::fuchsia_handles

Trait HandleBased

Source
pub trait HandleBased:
    AsHandleRef
    + From<Handle>
    + Into<Handle> {
    // Provided methods
    fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status> { ... }
    fn replace_handle(self, rights: Rights) -> Result<Self, Status> { ... }
    fn into_handle(self) -> Handle { ... }
    fn into_raw(self) -> u32 { ... }
    fn from_handle(handle: Handle) -> Self { ... }
    fn into_handle_based<H>(self) -> H
       where H: HandleBased { ... }
    fn from_handle_based<H>(h: H) -> Self
       where H: HandleBased { ... }
    fn is_invalid_handle(&self) -> bool { ... }
}
Expand description

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§

Source

fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>

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

Source

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 zx_handle_replace syscall.

Source

fn into_handle(self) -> Handle

Converts the value into its inner handle.

This is a convenience function which simply forwards to the Into trait.

Source

fn into_raw(self) -> u32

Converts the handle into it’s raw representation.

The caller takes ownership over the raw handle, and must close or transfer it to avoid a handle leak.

Source

fn from_handle(handle: Handle) -> Self

Creates an instance of this type from a handle.

This is a convenience function which simply forwards to the From trait.

Source

fn into_handle_based<H>(self) -> H
where H: HandleBased,

Creates an instance of another handle-based type from this value’s inner handle.

Source

fn from_handle_based<H>(h: H) -> Self
where H: HandleBased,

Creates an instance of this type from the inner handle of another handle-based type.

Source

fn is_invalid_handle(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl HandleBased for zx::bti::Bti

Source§

impl HandleBased for zx::exception::Exception

Source§

impl HandleBased for zx::iommu::Iommu

Source§

impl HandleBased for zx::pager::Pager

Source§

impl HandleBased for zx::pmt::Pmt

Source§

impl HandleBased for fidl::handle::fuchsia_handles::Bti

Source§

impl HandleBased for Channel

Source§

impl HandleBased for DebugLog

Source§

impl HandleBased for Event

Source§

impl HandleBased for EventPair

Source§

impl HandleBased for fidl::handle::fuchsia_handles::Exception

Source§

impl HandleBased for Guest

Source§

impl HandleBased for Handle

Source§

impl HandleBased for Interrupt

Source§

impl HandleBased for fidl::handle::fuchsia_handles::Iommu

Source§

impl HandleBased for Job

Source§

impl HandleBased for Msi

Source§

impl HandleBased for fidl::handle::fuchsia_handles::Pager

Source§

impl HandleBased for PciDevice

Source§

impl HandleBased for fidl::handle::fuchsia_handles::Pmt

Source§

impl HandleBased for Port

Source§

impl HandleBased for Process

Source§

impl HandleBased for Profile

Source§

impl HandleBased for Resource

Source§

impl HandleBased for Socket

Source§

impl HandleBased for Stream

Source§

impl HandleBased for SuspendToken

Source§

impl HandleBased for Thread

Source§

impl HandleBased for Vcpu

Source§

impl HandleBased for Vmar

Source§

impl HandleBased for Vmo

Source§

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

Source§

impl<Reference, Output> HandleBased for Clock<Reference, Output>
where Reference: Timeline, Output: Timeline,

Source§

impl<T> HandleBased for ClientEnd<T>

Source§

impl<T> HandleBased for ServerEnd<T>

Source§

impl<T> HandleBased for Timer<T>
where T: Timeline,