Trait fidl::handle::fuchsia_handles::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

Object Safety§

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,