pub struct App { /* private fields */ }
Expand description
The essential parts of the application, containing its Config
, State
, and Window
.
App
objects are created with a default maximum framerate of 30 using App::default
.
To change this, pass a Config
object with the desired framerate using App::config
.
Implementations§
source§impl App
impl App
pub fn window(&self) -> &Window
sourcepub fn run<F>(&mut self, frame_action: F)where
F: FnMut(&mut State, &mut Window),
pub fn run<F>(&mut self, frame_action: F)where F: FnMut(&mut State, &mut Window),
Begins running the terminal application.
This function begins a loop where key events are first registered, the window is cleared,
frame_action
is called adding characters to the Canvas
, and the window is redrawn.
If the time it takes to execute all of these is less than the App
expects according to
the framerate set in the Config
, the current thread is put to sleep until the next
frame, thereby limiting FPS.
Catches all unwinding panics that occur within frame_action
, allowing terminal recovery.