Trait Event

Source
pub trait Event: Component {
    type Traversal: Traversal;

    const AUTO_PROPAGATE: bool = false;
}
Expand description

Something that “happens” and might be read / observed by app logic.

Events can be stored in an Events<E> resource You can conveniently access events using the EventReader and EventWriter system parameter.

Events can also be “triggered” on a World, which will then cause any Observer of that trigger to run.

This trait can be derived.

Events implement the Component type (and they automatically do when they are derived). Events are (generally) not directly inserted as components. More often, the ComponentId is used to identify the event type within the context of the ECS.

Events must be thread-safe.

Provided Associated Constants§

Source

const AUTO_PROPAGATE: bool = false

When true, this event will always attempt to propagate when triggered, without requiring a call to Trigger::propagate.

Required Associated Types§

Source

type Traversal: Traversal

The component that describes which Entity to propagate this event to next, when propagation is enabled.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Event for HierarchyEvent
where HierarchyEvent: Send + Sync + 'static,

Source§

impl Event for GamepadEvent
where GamepadEvent: Send + Sync + 'static,

Source§

impl Event for GamepadRumbleRequest
where GamepadRumbleRequest: Send + Sync + 'static,

Source§

impl Event for RawGamepadEvent
where RawGamepadEvent: Send + Sync + 'static,

Source§

impl Event for AppExit
where AppExit: Send + Sync + 'static,

Source§

impl Event for FileDragAndDrop
where FileDragAndDrop: Send + Sync + 'static,

Source§

impl Event for Ime
where Ime: Send + Sync + 'static,

Source§

impl Event for AppLifecycle
where AppLifecycle: Send + Sync + 'static,

Source§

impl Event for WindowEvent
where WindowEvent: Send + Sync + 'static,

Source§

impl Event for ActionRequest
where ActionRequest: Send + Sync + 'static,

Source§

impl Event for UntypedAssetLoadFailedEvent

Source§

impl Event for GamepadAxisChangedEvent
where GamepadAxisChangedEvent: Send + Sync + 'static,

Source§

impl Event for GamepadButtonChangedEvent
where GamepadButtonChangedEvent: Send + Sync + 'static,

Source§

impl Event for GamepadButtonStateChangedEvent

Source§

impl Event for GamepadConnectionEvent
where GamepadConnectionEvent: Send + Sync + 'static,

Source§

impl Event for RawGamepadAxisChangedEvent

Source§

impl Event for RawGamepadButtonChangedEvent

Source§

impl Event for DoubleTapGesture
where DoubleTapGesture: Send + Sync + 'static,

Source§

impl Event for PanGesture
where PanGesture: Send + Sync + 'static,

Source§

impl Event for PinchGesture
where PinchGesture: Send + Sync + 'static,

Source§

impl Event for RotationGesture
where RotationGesture: Send + Sync + 'static,

Source§

impl Event for KeyboardFocusLost
where KeyboardFocusLost: Send + Sync + 'static,

Source§

impl Event for KeyboardInput
where KeyboardInput: Send + Sync + 'static,

Source§

impl Event for MouseButtonInput
where MouseButtonInput: Send + Sync + 'static,

Source§

impl Event for MouseMotion
where MouseMotion: Send + Sync + 'static,

Source§

impl Event for MouseWheel
where MouseWheel: Send + Sync + 'static,

Source§

impl Event for PointerHits
where PointerHits: Send + Sync + 'static,

Source§

impl Event for PointerInput
where PointerInput: Send + Sync + 'static,

Source§

impl Event for CursorEntered
where CursorEntered: Send + Sync + 'static,

Source§

impl Event for CursorLeft
where CursorLeft: Send + Sync + 'static,

Source§

impl Event for CursorMoved
where CursorMoved: Send + Sync + 'static,

Source§

impl Event for OnAdd
where OnAdd: Send + Sync + 'static,

Source§

impl Event for OnInsert
where OnInsert: Send + Sync + 'static,

Source§

impl Event for OnRemove
where OnRemove: Send + Sync + 'static,

Source§

impl Event for OnReplace
where OnReplace: Send + Sync + 'static,

Source§

impl Event for TouchInput
where TouchInput: Send + Sync + 'static,

Source§

impl Event for WindowMoved
where WindowMoved: Send + Sync + 'static,

Source§

impl Event for ReadbackComplete
where ReadbackComplete: Send + Sync + 'static,

Source§

impl Event for ScreenshotCaptured
where ScreenshotCaptured: Send + Sync + 'static,

Source§

impl Event for RequestRedraw
where RequestRedraw: Send + Sync + 'static,

Source§

impl Event for WindowBackendScaleFactorChanged

Source§

impl Event for WindowCloseRequested
where WindowCloseRequested: Send + Sync + 'static,

Source§

impl Event for WindowClosed
where WindowClosed: Send + Sync + 'static,

Source§

impl Event for WindowClosing
where WindowClosing: Send + Sync + 'static,

Source§

impl Event for WindowCreated
where WindowCreated: Send + Sync + 'static,

Source§

impl Event for WindowDestroyed
where WindowDestroyed: Send + Sync + 'static,

Source§

impl Event for WindowFocused
where WindowFocused: Send + Sync + 'static,

Source§

impl Event for WindowOccluded
where WindowOccluded: Send + Sync + 'static,

Source§

impl Event for WindowResized
where WindowResized: Send + Sync + 'static,

Source§

impl Event for WindowScaleFactorChanged
where WindowScaleFactorChanged: Send + Sync + 'static,

Source§

impl Event for WindowThemeChanged
where WindowThemeChanged: Send + Sync + 'static,

Source§

impl Event for WakeUp
where WakeUp: Send + Sync + 'static,

Source§

impl Event for RemovedComponentEntity
where RemovedComponentEntity: Send + Sync + 'static,

Source§

impl<A> Event for AssetEvent<A>
where A: Asset, AssetEvent<A>: Send + Sync + 'static,

Source§

impl<A> Event for AssetLoadFailedEvent<A>
where A: Asset, AssetLoadFailedEvent<A>: Send + Sync + 'static,

Source§

impl<E> Event for Pointer<E>
where E: Debug + Clone + Reflect,