[][src]Struct sunrise_libuser::types::HandleRef

#[repr(transparent)]pub struct HandleRef<'a> {
    pub(crate) inner: NonZeroU32,
    lifetime: PhantomData<&'a Handle>,
}

A fake reference to a Handle. Has the same representation as a real Handle, but is bound to the real handle's lifetime.

This pattern allows for passing handle arrays without giving up ownership of the handle, and without an expensive conversion from an array of pointers to an array of handles.

Fields

inner: NonZeroU32

The underlying handle number.

lifetime: PhantomData<&'a Handle>

The real handle this reference is tied to.

Implementations

impl<'a> HandleRef<'a>[src]

pub fn staticify(self) -> HandleRef<'static>[src]

Remove the lifetime on the current HandleRef. See Handle::as_ref_static() for more information on the safety of this operation.

pub fn wait_async(
    self,
    queue: WorkQueue
) -> impl Future<Output = Result<(), Error>> + Unpin
[src]

Returns a future that waits for the current handle to get signaled. This effectively registers the currently executing Task to be polled again by the future executor backing the given WorkQueue when this handle gets signaled.

Panics

Panics if used from outside the context of a Future spawned on a libuser future executor. Please make sure you only call this function from a future spawned on a WaitableManager.

Trait Implementations

impl<'a> Clone for HandleRef<'a>[src]

impl<'a> Copy for HandleRef<'a>[src]

impl<'a> Debug for HandleRef<'a>[src]

impl<'a> Eq for HandleRef<'a>[src]

impl<'a> PartialEq<HandleRef<'a>> for HandleRef<'a>[src]

impl<'a> StructuralEq for HandleRef<'a>[src]

impl<'a> StructuralPartialEq for HandleRef<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for HandleRef<'a>

impl<'a> Send for HandleRef<'a>

impl<'a> Sync for HandleRef<'a>

impl<'a> Unpin for HandleRef<'a>

impl<'a> UnwindSafe for HandleRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SizedIPCBuffer for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.