[][src]Struct sunrise_libuser::types::ReadableEvent

#[repr(transparent)]pub struct ReadableEvent(pub Handle);

The readable part of an event. The user shall use this end to verify if the event is signaled, and wait for the signaling through wait_synchronization. The user can also use this handle to clear the signaled state through ReadableEvent::clear().

Implementations

impl ReadableEvent[src]

pub fn clear(&self) -> Result<(), KernelError>[src]

Clears the signaled state.

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

Waits for the event to get signaled.

Note: This function is a bit of a footgun. If you intend to have multiple futures wait on the same event (to use it like a semaphore), please look at ReadableEvent::wait_async_cb() instead.

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.

pub fn wait_async_cb<F, T>(
    &self,
    queue: WorkQueue,
    f: F
) -> impl Future<Output = T> + Unpin where
    F: FnMut() -> Option<T> + Unpin
[src]

Turns this ReadableEvent into a semaphore-like structure.

This function will repeatedly run f when the event is triggered, until it returns true. When it returns false, the future will first clear the event before waiting on it.

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 Debug for ReadableEvent[src]

Auto Trait Implementations

impl RefUnwindSafe for ReadableEvent

impl Send for ReadableEvent

impl Sync for ReadableEvent

impl Unpin for ReadableEvent

impl UnwindSafe for ReadableEvent

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, 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.