Struct bevy_eventlistener::callbacks::ListenerInput
source · pub struct ListenerInput<E: EntityEvent> { /* private fields */ }
Expand description
Data from an event that triggered an On<Event>
listener, and is
currently bubbling through the entity hierarchy.
This is accessed as a bevy resource in the callback system. This resource is only available to callback systems.
fn my_callback(mut event: ListenerMut<MyEvent>) {
event.foo += 1; // Mutate the event that is being bubbled
event.target(); // The entity that was originally targeted
event.listener(); // The entity that was listening for this event
event.stop_propagation(); // Stop the event from bubbling further
}
Implementations§
source§impl<E: EntityEvent> ListenerInput<E>
impl<E: EntityEvent> ListenerInput<E>
sourcepub fn listener(&self) -> Entity
pub fn listener(&self) -> Entity
The entity that was listening for this event. Call target()
to get the entity that this
event originally targeted before it started bubbling through the hierarchy. Note that the
target and listener can be the same entity.
sourcepub fn stop_propagation(&mut self)
pub fn stop_propagation(&mut self)
When called, the event will stop bubbling up the hierarchy to its parent.
Trait Implementations§
source§impl<E: Clone + EntityEvent> Clone for ListenerInput<E>
impl<E: Clone + EntityEvent> Clone for ListenerInput<E>
source§fn clone(&self) -> ListenerInput<E>
fn clone(&self) -> ListenerInput<E>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<E: Debug + EntityEvent> Debug for ListenerInput<E>
impl<E: Debug + EntityEvent> Debug for ListenerInput<E>
source§impl<E: EntityEvent> Deref for ListenerInput<E>
impl<E: EntityEvent> Deref for ListenerInput<E>
source§impl<E: EntityEvent> DerefMut for ListenerInput<E>
impl<E: EntityEvent> DerefMut for ListenerInput<E>
source§impl<E: PartialEq + EntityEvent> PartialEq for ListenerInput<E>
impl<E: PartialEq + EntityEvent> PartialEq for ListenerInput<E>
source§fn eq(&self, other: &ListenerInput<E>) -> bool
fn eq(&self, other: &ListenerInput<E>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<E: EntityEvent> Resource for ListenerInput<E>
impl<E: EntityEvent> StructuralPartialEq for ListenerInput<E>
Auto Trait Implementations§
impl<E> RefUnwindSafe for ListenerInput<E>where
E: RefUnwindSafe,
impl<E> Send for ListenerInput<E>
impl<E> Sync for ListenerInput<E>
impl<E> Unpin for ListenerInput<E>where
E: Unpin,
impl<E> UnwindSafe for ListenerInput<E>where
E: UnwindSafe,
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.