Skip to main content

EngineEvent

Enum EngineEvent 

Source
#[non_exhaustive]
pub enum EngineEvent {
Show 13 variants WidgetAdded { id: WidgetId, parent: WidgetId, }, EventMaskChanged { scope: MaskScope, old: EventMask, new: EventMask, }, EventBroadcast { kind: EventKind, recipients: usize, }, CustomEventDropped { target: EventTarget, }, FontLoaded { font_name: String, font_size: u16, }, GlyphAtlasPageAdded { pages: usize, }, FocusChanged { old: Option<WidgetId>, new: Option<WidgetId>, }, ActionTriggered { id: WidgetId, cancel: bool, }, TimerFired { id: TimerId, repeat: bool, }, TimerCancelled { id: TimerId, }, IdleRan { callbacks: usize, }, AnimationTicked { recipients: usize, elapsed: Duration, }, Error { error: Error, },
}
Expand description

An action Pushrod performs internally, carried by Event::Engine.

Engine events are broadcast after the action has completed, to Widgets whose mask includes EventMask::ENGINE, then to Engine::on_engine_event callbacks and Engine::on_event callbacks. They never cause further internal actions by themselves, so they cannot loop.

Rule for contributors: any change that adds an internal action must add a variant here and emit it. More variants are added as the engine gains the actions.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

WidgetAdded

A Widget was added to the window. Not emitted for the root Widget.

Fields

§id: WidgetId

The ID of the new Widget.

§parent: WidgetId

The ID of its parent.

§

EventMaskChanged

An event mask changed.

Fields

§scope: MaskScope

Whose mask changed.

§old: EventMask

The mask before the change.

§new: EventMask

The mask after the change.

§

EventBroadcast

An event was broadcast to every interested Widget.

Fields

§kind: EventKind

The kind of the broadcast event.

§recipients: usize

How many Widgets received it.

§

CustomEventDropped

A custom event was discarded because the per-frame limit on custom events was reached, which stops callbacks that re-post forever.

Fields

§target: EventTarget

The target of the discarded event.

§

FontLoaded

A font was loaded from disk, the first time text was drawn with it. Each (font_name, font_size, style) loads once per process run.

Fields

§font_name: String

The path of the font file.

§font_size: u16

The font size in points.

§

GlyphAtlasPageAdded

A glyph atlas texture was created because the existing ones were full (or none existed).

Fields

§pages: usize

How many atlas textures exist now.

§

FocusChanged

The keyboard focus moved, by a click, Tab, an arrow key, or set_focus.

Fields

§old: Option<WidgetId>

The Widget that had focus, if any.

§new: Option<WidgetId>

The Widget that has focus now, if any.

§

ActionTriggered

Return or Escape activated a form’s default or cancel Widget.

Fields

§id: WidgetId

The Widget that was activated.

§cancel: bool

false for the default action (Return), true for the cancel action (Escape).

§

TimerFired

A timer registered with Engine::on_timer fired and its callback ran.

Fields

§id: TimerId

The timer that fired.

§repeat: bool

true if it repeats; false if this was its only firing.

§

TimerCancelled

A timer was cancelled before it fired again, by Ui::cancel_timer or Engine::cancel_timer. Not sent when a one-shot timer simply finishes.

Fields

§id: TimerId

The timer that was cancelled.

§

IdleRan

The idle callbacks ran because no events were pending.

Fields

§callbacks: usize

How many idle callbacks ran.

§

AnimationTicked

Event::Tick was delivered to the Widgets that requested animation.

Fields

§recipients: usize

How many Widgets received the tick.

§elapsed: Duration

The time since the previous frame’s tick.

§

Error

An operation failed while the run loop was running (a font that would not load, a texture the driver could not create). The loop keeps running; the failed drawing is skipped.

Fields

§error: Error

What failed.

Implementations§

Source§

impl EngineEvent

Source

pub fn kind(&self) -> EngineEventKind

Returns the kind of this engine event, for filtering.

§Returns

The EngineEventKind matching the variant.

Trait Implementations§

Source§

impl Clone for EngineEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EngineEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for EngineEvent

Source§

impl PartialEq for EngineEvent

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EngineEvent

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.