Function input::testutil::create_event_reader
source · pub fn create_event_reader<EventGeneratorFunction, CustomEvent>(
event_generator: EventGeneratorFunction
) -> impl EventReaderFnwhere
EventGeneratorFunction: Fn() -> Result<Option<Event<CustomEvent>>> + Sync + Send + 'static,
CustomEvent: CustomEvent,
Expand description
Create an event reader that will map the provided events to the internal representation of the events. This allows for mocking of event input when testing at the highest level of the application.
This function does not accept any Event::MetaEvent
or Event::StandardEvent
event types, instead
use other event types that will map to the expected value using the keybindings.
This function should be used sparingly, and instead with_event_handler
should be used where possible.
Panics
If provided an event generator that returns a Event::MetaEvent
or Event::StandardEvent
event type.