pub trait Loop {
type Error: From<Error> + Debug;
// Required methods
fn update(
&mut self,
context: &mut Context,
input: &Input<'_>
) -> Result<(), Self::Error>;
fn render(&self, frame: &mut Frame<'_>) -> Result<(), Self::Error>;
// Provided methods
fn error_occurred(&mut self, err: Self::Error) { ... }
fn close_requested(&mut self) -> bool { ... }
}
Expand description
The main application loop.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn error_occurred(&mut self, err: Self::Error)
fn error_occurred(&mut self, err: Self::Error)
Calls when an error has occurred.
sourcefn close_requested(&mut self) -> bool
fn close_requested(&mut self) -> bool
Calls when a close is requested.
Returns a flag whether to terminate the main loop or not.