pub struct EventReceiver<A>{ /* private fields */ }Expand description
An event channel receiver.
Use Event::receiver to create a receiver, drop to stop listening.
Implementations§
Source§impl<A> EventReceiver<A>
impl<A> EventReceiver<A>
Sourcepub fn recv(&self) -> Result<A, AppChannelError>
pub fn recv(&self) -> Result<A, AppChannelError>
Receives the oldest update, blocks until the event updates.
Note that oldest here refers to send order (FIFO), not the args creation timestamp.
Sourcepub fn try_recv(&self) -> Result<Option<A>, AppChannelError>
pub fn try_recv(&self) -> Result<Option<A>, AppChannelError>
Tries to receive the oldest sent update not received, returns Ok(args) if there was at least
one update, or returns Err(None) if there was no update or returns Err(AppDisconnected) if the connected
app has exited.
Sourcepub fn recv_deadline(&self, deadline: Instant) -> Result<A, AppChannelError>
pub fn recv_deadline(&self, deadline: Instant) -> Result<A, AppChannelError>
Receives the oldest send update, blocks until the event updates or until the deadline is reached.
Sourcepub fn recv_timeout(&self, dur: Duration) -> Result<A, AppChannelError>
pub fn recv_timeout(&self, dur: Duration) -> Result<A, AppChannelError>
Receives the oldest send update, blocks until the event updates or until timeout.
Sourcepub async fn recv_async(&self) -> Result<A, AppChannelError>
pub async fn recv_async(&self) -> Result<A, AppChannelError>
Returns a future that receives the oldest send update, awaits until an event update occurs.
Sourcepub fn into_recv_async(
self,
) -> impl Future<Output = Result<A, AppChannelError>> + Send + Sync + 'static
pub fn into_recv_async( self, ) -> impl Future<Output = Result<A, AppChannelError>> + Send + Sync + 'static
Turns into a future that receives the oldest send update, awaits until an event update occurs.
Sourcepub fn iter(&self) -> Iter<'_, A>
pub fn iter(&self) -> Iter<'_, A>
Creates a blocking iterator over event updates, if there are no updates sent the iterator blocks, the iterator only finishes when the app shuts-down.
Trait Implementations§
Source§impl<A> Clone for EventReceiver<A>
impl<A> Clone for EventReceiver<A>
Source§impl<A> Debug for EventReceiver<A>
impl<A> Debug for EventReceiver<A>
Source§impl<A> From<EventReceiver<A>> for Receiver<A>
impl<A> From<EventReceiver<A>> for Receiver<A>
Source§fn from(e: EventReceiver<A>) -> Self
fn from(e: EventReceiver<A>) -> Self
Source§impl<'a, A> IntoIterator for &'a EventReceiver<A>
impl<'a, A> IntoIterator for &'a EventReceiver<A>
Source§impl<A> IntoIterator for EventReceiver<A>
impl<A> IntoIterator for EventReceiver<A>
Auto Trait Implementations§
impl<A> Freeze for EventReceiver<A>
impl<A> RefUnwindSafe for EventReceiver<A>
impl<A> Send for EventReceiver<A>
impl<A> Sync for EventReceiver<A>
impl<A> Unpin for EventReceiver<A>
impl<A> UnwindSafe for EventReceiver<A>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more