Trait MainLoop

Source
pub trait MainLoop {
    // Required method
    fn main_loop(&mut self) -> MainLoopEvent;
}
Expand description

A trait that abstracts a main loop mechanism that can be used on native targets as well as the wasm32-unknown-emscripten target. The purpose of this is to get around the browser limitations that prevent you from just naively looping, which would cause the browser tab to be frozen/killed. Use this by implementing the trait on the data object that contains all data that should be available to the main loop

Required Methods§

Source

fn main_loop(&mut self) -> MainLoopEvent

Will be run once per loop iteration. Functionally equivalent to the body of a loop statement. Use the return value to indicate if the loop should continue or terminate.

Implementors§