pub struct Unowned<'a, T: Into<NullableHandle>> { /* 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: Into<NullableHandle>> Unowned<'a, T>
impl<'a, T: Into<NullableHandle>> Unowned<'a, T>
Sourcepub fn new<U: AsHandleRef + From<NullableHandle>>(inner: &'a U) -> Selfwhere
T: From<U>,
pub fn new<U: AsHandleRef + From<NullableHandle>>(inner: &'a U) -> Selfwhere
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>.
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) -> WaitResult
pub fn wait_async( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
Source§impl<'a> Unowned<'a, NullableHandle>
impl<'a> Unowned<'a, NullableHandle>
Sourcepub fn cast<T: HandleBased>(self) -> Unowned<'a, T>
pub fn cast<T: HandleBased>(self) -> Unowned<'a, T>
Convert this HandleRef to one of a specific type.
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<'_>
object_wait_many.