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: PartialOrd> PartialOrd for Unowned<'a, T>
impl<'a, T: PartialOrd> PartialOrd for Unowned<'a, T>
impl<'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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)