pub struct Input;Expand description
A zero-sized namespace struct providing static input event extraction methods.
This struct follows the same pattern as App, serving as a namespace for
free-standing input utility functions that extract data from DOM events.
Implementations§
Source§impl Input
Implements static event extraction methods on the Input namespace struct.
impl Input
Implements static event extraction methods on the Input namespace struct.
Sourcepub fn extract_key_code(event: &Event) -> String
pub fn extract_key_code(event: &Event) -> String
Source§impl Input
Implements DOM event listener registration on the Input namespace struct.
impl Input
Implements DOM event listener registration on the Input namespace struct.
This is the wiring layer that routes DOM events into InputState:
keyboard events bind to window (a <canvas> is not focusable by
default), while mouse and touch events bind to the canvas element so
hit-testing coordinates stay canvas-local. Registered closures are
.forget()-ed and stay alive for the lifetime of the document,
matching the engine’s mount-only convention.
Sourcepub fn attach(
state_cell: InputStateCell,
window: &Window,
pointer_target: &EventTarget,
) -> InputStateCell
pub fn attach( state_cell: InputStateCell, window: &Window, pointer_target: &EventTarget, ) -> InputStateCell
Attaches all input listeners and returns the shared state cell.
§Arguments
InputStateCell- The shared input state to mutate from event handlers.&Window- The global window, receiving keyboard events.&EventTarget- The pointer target (typically the canvas element).
§Returns
InputStateCell- The same cell passed in, for convenient chaining.