Skip to main content

EventHook

Type Alias EventHook 

Source
pub type EventHook = Rc<dyn Fn(&mut App)>;
Expand description

The measurement hook that injects scripted input before a frame runs.

The platform calls it with the app before every frame but the first, which mounts the app and lays it out, and the hook delivers input through App::handle_event, which is the path every real event takes. Nothing in the library sets it: it exists so a benchmark can script input on the window backend, where nothing else can reach the app between frames. The time from a call to the end of that frame’s present is the event’s latency. Like FrameHook, the hook is shared, so it keeps any counter it needs behind a Cell or an Rc.

Aliased Type§

pub struct EventHook { /* private fields */ }