Type Alias ZirconHandleRef

pub type ZirconHandleRef<'a> = Unowned<'a, Handle>;

Aliased Type§

struct ZirconHandleRef<'a> { /* private fields */ }

Implementations

§

impl<'a, T> Unowned<'a, T>
where T: Into<Handle>,

pub fn new<U>(inner: &'a U) -> Unowned<'a, T>
where U: AsHandleRef + From<Handle>, T: From<U>,

Returns a new object that borrows the underyling handle. This will work for any type that implements From<U> where U is handle-like i.e. it implements AsHandleRef and From<Handle>.

§

impl<'a, T> Unowned<'a, T>
where T: HandleBased,

pub unsafe fn from_raw_handle(handle: u32) -> Unowned<'a, T>

Create a HandleRef from a raw handle. Use this method when you are given a raw handle but should not take ownership of it. Examples include process-global handles like the root VMAR. This method should be called with an explicitly provided lifetime that must not outlive the lifetime during which the handle is owned by the current process. It is unsafe because most of the time, it is better to use a Handle to prevent leaking resources.

§Safety

handle must be a valid handle (i.e. not dangling), or ZX_HANDLE_INVALID. If handle is a valid handle, then it must not be closed for the lifetime 'a.

pub fn raw_handle(&self) -> u32

pub fn duplicate(&self, rights: Rights) -> Result<T, Status>

pub fn signal( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>

pub fn wait( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> Result<Signals, Status>

pub fn wait_async( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>

§

impl<'a> Unowned<'a, Handle>

pub fn cast<T>(self) -> Unowned<'a, T>
where T: HandleBased,

Convert this HandleRef to one of a specific type.

Trait Implementations

§

impl<'a, T> AsHandleRef for Unowned<'a, T>
where T: HandleBased,

§

fn as_handle_ref(&self) -> Unowned<'_, Handle>

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

fn raw_handle(&self) -> u32

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 signal_handle( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>

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

fn wait_handle( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> Result<Signals, Status>

Waits on a handle. Wraps the zx_object_wait_one syscall.
§

fn wait_async_handle( &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. zx_object_wait_async syscall.
§

fn get_name(&self) -> Result<Name, Status>

Get the [Property::NAME] property for this object. Read more
§

fn set_name(&self, name: &Name) -> Result<(), Status>

Set the [Property::NAME] property for this object. Read more
§

fn basic_info(&self) -> Result<HandleBasicInfo, Status>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_BASIC topic.
§

fn count_info(&self) -> Result<HandleCountInfo, Status>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_COUNT topic.
§

fn get_koid(&self) -> Result<Koid, Status>

Returns the koid (kernel object ID) for this handle.
§

impl<T> Clone for Unowned<'_, T>
where T: HandleBased,

§

fn clone(&self) -> Unowned<'_, T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<'a, T> Debug for Unowned<'a, T>
where T: Debug + Into<Handle>,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'a, T> Deref for Unowned<'a, T>
where T: Into<Handle>,

§

type Target = T

The resulting type after dereferencing.
§

fn deref(&self) -> &<Unowned<'a, T> as Deref>::Target

Dereferences the value.
§

impl<T> Drop for Unowned<'_, T>
where T: Into<Handle>,

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<'a, T> Hash for Unowned<'a, T>
where T: Hash + Into<Handle>,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<'a, T> Ord for Unowned<'a, T>
where T: Ord + Into<Handle>,

§

fn cmp(&self, other: &Unowned<'a, T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<'a, T> PartialEq for Unowned<'a, T>
where T: PartialEq + Into<Handle>,

§

fn eq(&self, other: &Unowned<'a, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<'a, T> PartialOrd for Unowned<'a, T>
where T: PartialOrd + Into<Handle>,

§

fn partial_cmp(&self, other: &Unowned<'a, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<'a, T> Eq for Unowned<'a, T>
where T: Eq + Into<Handle>,

§

impl<'a, T> StructuralPartialEq for Unowned<'a, T>
where T: Into<Handle>,