pub type HandleRef<'a> = Unowned<'a, Handle>;
Aliased Type§
struct HandleRef<'a> { /* private fields */ }
Implementations
Source§impl<'a> Unowned<'a, Handle>
impl<'a> Unowned<'a, Handle>
Sourcepub fn cast<T>(self) -> Unowned<'a, T>where
T: HandleBased,
pub fn cast<T>(self) -> Unowned<'a, T>where
T: HandleBased,
Convert this HandleRef to one of a specific type.
Source§impl<'a, T> Unowned<'a, T>where
T: HandleBased,
impl<'a, T> Unowned<'a, T>where
T: HandleBased,
Sourcepub unsafe fn from_raw_handle(handle: u32) -> Unowned<'a, T>
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>
Trait Implementations
Source§impl<'a, T> AsHandleRef for Unowned<'a, T>where
T: HandleBased,
impl<'a, T> AsHandleRef for Unowned<'a, T>where
T: HandleBased,
Source§fn as_handle_ref(&self) -> Unowned<'_, Handle>
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
.Source§fn raw_handle(&self) -> u32
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).
Source§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
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.
Source§fn wait_handle(
&self,
signals: Signals,
deadline: Instant<MonotonicTimeline>,
) -> Result<Signals, Status>
fn wait_handle( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> Result<Signals, Status>
Waits on a handle. Wraps the
zx_object_wait_one
syscall.
Source§fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts,
) -> Result<(), Status>
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.
Source§fn get_name(&self) -> Result<Name, Status>
fn get_name(&self) -> Result<Name, Status>
Get the Property::NAME property for this object. Read more
Source§fn set_name(&self, name: &Name) -> Result<(), Status>
fn set_name(&self, name: &Name) -> Result<(), Status>
Set the Property::NAME property for this object. Read more
Source§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
Wraps the
zx_object_get_info
syscall for the ZX_INFO_HANDLE_BASIC topic.
Source§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
Wraps the
zx_object_get_info
syscall for the ZX_INFO_HANDLE_COUNT topic.
Source§impl<T> Clone for Unowned<'_, T>where
T: HandleBased,
impl<T> Clone for Unowned<'_, T>where
T: HandleBased,
Source§impl<'a, T> Ord for Unowned<'a, T>where
T: Ord,
impl<'a, T> Ord for Unowned<'a, T>where
T: Ord,
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more