Event

Struct Event 

Source
pub struct Event {
    pub origin: Entity,
    pub target: Entity,
    pub propagation: Propagation,
    pub consumable: bool,
    pub unique: bool,
    pub order: i32,
    pub message: Box<dyn Message>,
    /* private fields */
}
Expand description

An event is a wrapper around a message and provides metadata on how the event should be propagated through the tree

Fields§

§origin: Entity§target: Entity§propagation: Propagation§consumable: bool§unique: bool§order: i32§message: Box<dyn Message>

Implementations§

Source§

impl Event

Source

pub fn new<M>(message: M) -> Event
where M: Message,

Creates a new event with a specified message

Source

pub fn target(self, entity: Entity) -> Event

Sets the target of the event

Source

pub fn origin(self, entity: Entity) -> Event

Sets the origin of the event

Source

pub fn unique(self) -> Event

Specifies that the event is unique (only one of this event type should exist in the event queue at once)

Source

pub fn propagate(self, propagation: Propagation) -> Event

Sets the propagation of the event

Source

pub fn direct(self, entity: Entity) -> Event

Source

pub fn consume(&mut self)

Consumes the event (prevents the event from continuing on its propagation path)

Trait Implementations§

Source§

impl PartialEq for Event

Source§

fn eq(&self, other: &Event) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl Freeze for Event

§

impl !RefUnwindSafe for Event

§

impl !Send for Event

§

impl !Sync for Event

§

impl Unpin for Event

§

impl !UnwindSafe for Event

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<S> Message for S
where S: 'static + PartialEq,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn equals_a(&self, other: &(dyn Message + 'static)) -> bool

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Node for T
where T: 'static,