pub struct Unowned<'a, T> { /* private fields */ }
Expand description
A borrowed value of type T
.
This is primarily used for working with borrowed values of HandleBased
types.
Implementations§
source§impl<'a, T: HandleBased> Unowned<'a, T>
impl<'a, T: HandleBased> Unowned<'a, T>
sourcepub unsafe fn from_raw_handle(handle: zx_handle_t) -> Self
pub unsafe fn from_raw_handle(handle: zx_handle_t) -> Self
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) -> zx_handle_t
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: MonotonicInstant, ) -> Result<Signals, Status>
pub fn wait_async( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
Trait Implementations§
source§impl<'a, T: HandleBased> AsHandleRef for Unowned<'a, T>
impl<'a, T: HandleBased> AsHandleRef for Unowned<'a, T>
source§fn as_handle_ref(&self) -> HandleRef<'_>
fn as_handle_ref(&self) -> HandleRef<'_>
Get a reference to the handle. One important use of such a reference is
for
object_wait_many
.source§fn raw_handle(&self) -> zx_handle_t
fn raw_handle(&self) -> zx_handle_t
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: MonotonicInstant,
) -> Result<Signals, Status>
fn wait_handle( &self, signals: Signals, deadline: MonotonicInstant, ) -> 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: HandleBased> Clone for Unowned<'_, T>
impl<T: HandleBased> Clone for Unowned<'_, T>
source§impl<'a, T: Ord> Ord for Unowned<'a, T>
impl<'a, T: Ord> Ord for Unowned<'a, T>
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
source§impl<'a, T: PartialEq> PartialEq for Unowned<'a, T>
impl<'a, T: PartialEq> PartialEq for Unowned<'a, T>
source§impl<'a, T: PartialOrd> PartialOrd for Unowned<'a, T>
impl<'a, T: PartialOrd> PartialOrd for Unowned<'a, T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<'a, T: Eq> Eq for Unowned<'a, T>
impl<'a, T> StructuralPartialEq for Unowned<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Unowned<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for Unowned<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Unowned<'a, T>
impl<'a, T> Sync for Unowned<'a, T>where
T: Sync,
impl<'a, T> Unpin for Unowned<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Unowned<'a, T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)