[][src]Struct bevy_app::prelude::EventReader

pub struct EventReader<T> { /* fields omitted */ }

Reads events of type T in order and tracks which events have already been read.

Implementations

impl<T> EventReader<T>[src]

pub fn iter<'a>(
    &mut self,
    events: &'a Events<T>
) -> impl DoubleEndedIterator<Item = &'a T>
[src]

Iterates over the events this EventReader has not seen yet. This updates the EventReader's event counter, which means subsequent event reads will not include events that happened before now.

pub fn iter_with_id<'a>(
    &mut self,
    events: &'a Events<T>
) -> impl DoubleEndedIterator<Item = (&'a T, EventId<T>)>
[src]

Like iter, except also returning the EventId of the events.

pub fn latest<'a>(&mut self, events: &'a Events<T>) -> Option<&'a T>[src]

Retrieves the latest event that this EventReader hasn't seen yet. This updates the EventReader's event counter, which means subsequent event reads will not include events that happened before now.

pub fn latest_with_id<'a>(
    &mut self,
    events: &'a Events<T>
) -> Option<(&'a T, EventId<T>)>
[src]

Like latest, except also returning the EventId of the event.

pub fn find_latest<'a>(
    &mut self,
    events: &'a Events<T>,
    predicate: impl FnMut(&&T) -> bool
) -> Option<&'a T>
[src]

Retrieves the latest event that matches the given predicate that this reader hasn't seen yet. This updates the EventReader's event counter, which means subsequent event reads will not include events that happened before now.

pub fn find_latest_with_id<'a>(
    &mut self,
    events: &'a Events<T>,
    predicate: impl FnMut(&&T) -> bool
) -> Option<(&'a T, EventId<T>)>
[src]

Like find_latest, except also returning the EventId of the event.

pub fn earliest<'a>(&mut self, events: &'a Events<T>) -> Option<&'a T>[src]

Retrieves the earliest event in events that this reader hasn't seen yet. This updates the EventReader's event counter, which means subsequent event reads will not include events that happened before now.

pub fn earliest_with_id<'a>(
    &mut self,
    events: &'a Events<T>
) -> Option<(&'a T, EventId<T>)>
[src]

Like earliest, except also returning the EventId of the event.

Trait Implementations

impl<T> Default for EventReader<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for EventReader<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for EventReader<T> where
    T: Send
[src]

impl<T> Sync for EventReader<T> where
    T: Sync
[src]

impl<T> Unpin for EventReader<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for EventReader<T> where
    T: UnwindSafe
[src]

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> Component for T where
    T: 'static + Send + Sync
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

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

impl<T> FromResources for T where
    T: Default
[src]

impl<T> Instrument for T[src]

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

impl<T> Resource for T where
    T: 'static + Send + Sync
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,