Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 26 variants Pressed, TextChanged(String), Submitted, ToggleChanged(bool), ValueChanged(f64), SelectionChanged(i64), SelectionSet(Vec<i64>), FocusChanged(bool), Tap(Point), LongPress(Point), ContextMenu(Point), Drag { phase: DragPhase, location: Point, translation: Point, }, ScrollChanged(Point), FrameChanged(Size), NavBack { already_popped: bool, }, Key(KeyEvent), Pointer(PointerEvent), WindowResized(Size), RouteRequested(String), PresentResult { req: u64, result: PresentResult, }, Custom { tag: &'static str, num: f64, text: String, }, MenuAction(u64), ToolbarChanged { action: u64, value: ToolbarValue, }, Lifecycle(Lifecycle), WindowClosed, WindowFocused(bool),
}

Variants§

§

Pressed

§

TextChanged(String)

§

Submitted

§

ToggleChanged(bool)

§

ValueChanged(f64)

§

SelectionChanged(i64)

§

SelectionSet(Vec<i64>)

A multi-select list’s selection changed: the FULL set of selected row indices, ascending (empty = nothing selected). Emitted instead of SelectionChanged where ListProps::multi_select is honored (docs/list.md).

§

FocusChanged(bool)

§

Tap(Point)

§

LongPress(Point)

§

ContextMenu(Point)

§

Drag

A drag/pan gesture (docs/shapes.md). location is in the node’s local coordinates; translation is the cumulative movement since Began.

Fields

§location: Point
§translation: Point
§

ScrollChanged(Point)

§

FrameChanged(Size)

A canvas node was re-framed by layout; re-record (§11). Nav pane/page containers also report their allocated size with this (docs/navigation.md).

§

NavBack

Native back navigation (iOS back button/swipe, Android system back or toolbar up). already_popped = the toolkit already performed the pop natively (iOS); the nav host then syncs its stack WITHOUT re-issuing NavPatch::Popped.

Fields

§already_popped: bool
§

Key(KeyEvent)

§

Pointer(PointerEvent)

§

WindowResized(Size)

§

RouteRequested(String)

The platform asks the app to show a route (docs/navigation.md): a runtime deep link — on web-dom, the URL hash changing under the app (hand-edited, or browser back/forward). Emitted on WINDOW_NODE; day-core answers with navigate() when the route differs from the current one. Launch-time deep links use DAY_DEEPLINK/set_launch_deeplink instead — this variant is for changes while the app runs.

§

PresentResult

A native modal answered request req (docs/dialogs.md).

Fields

§req: u64
§

Custom

An open, piece-defined event (§8.2). tag names the event for in-process emitters (a static literal); it is empty for events that cross a native boundary (JNI/C-ABI), which carry only the primitive num/text payload. A piece’s cx.on reads whichever fields it needs. This is the escape hatch for events the fixed variants above don’t cover (a web view’s URL, a picked date, …).

Fields

§tag: &'static str
§num: f64
§text: String
§

MenuAction(u64)

A menu item (app menu or context menu) with this action id was activated (§ menus). day-core routes it to the app closure registered for the id. Standard-role items don’t carry an id (role items are handled natively) so they never emit this.

§

ToolbarChanged

A toolbar item produced a value — a search field’s text, a toggle’s new state (docs/toolbars.md). action is the item’s dispatch id, from the same registry Event::MenuAction uses, and day-core routes it to the closure registered for it. A plain toolbar button has no value and emits MenuAction instead.

Fields

§action: u64
§

Lifecycle(Lifecycle)

The app moved through a lifecycle phase (docs/lifecycle.md). Backends emit this from the native app/activity delegate; day-core routes it to the app’s on_lifecycle handlers.

§

WindowClosed

A secondary native window closed — the title-bar close, a platform gesture (an app-switcher swipe, an activity finish), or Toolkit::close_window — emitted on the WINDOW’S ROOT node after the platform committed the close. day-core disposes the window’s subtree on receipt, so native and programmatic closes share one teardown path (docs/windows.md). Never emitted for the primary window (its close terminates the app).

§

WindowFocused(bool)

A secondary window’s key/active state changed — emitted on the window’s root node. day-core tracks the focused window with it (dialog parenting, dayscript targeting).

Implementations§

Source§

impl Event

Source

pub fn custom(tag: &'static str, text: impl Into<String>) -> Event

Build a text-carrying Event::Custom (with num defaulted to 0) — the common case for an in-process piece reporting a value back: emit(node, Event::custom("webview:url", url)).

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

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 Event

Source§

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

Formats the value using the given formatter. Read more
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 (const: unstable) · 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.
Source§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin 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> 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 = 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.
Day API ↩ Guides· daybrite.dev