pub trait Loop {
    type Error: From<Error> + Debug;

    fn update(
        &mut self,
        context: &mut Context,
        input: &Input<'_>
    ) -> Result<(), Self::Error>; fn render(&self, frame: &mut Frame<'_>) -> Result<(), Self::Error>; 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

Calls before render a frame to update the state.

It accepts the Context and an Input. The context uses to update the application state, create or delete any resources. The input contains an inputed data like a mouse position and etc.

Calls on render a frame.

It accepts a Frame to draw something on the canvas.

Provided Methods

Calls when an error has occurred.

Calls when a close is requested.

Returns a flag whether to terminate the main loop or not.

Implementations on Foreign Types

Implementors