devotee_backend/lib.rs
1#![no_std]
2#![deny(missing_docs)]
3
4//! Set of definitions for backend-y stuff of the devotee project.
5
6/// So-so middleware implementation.
7pub mod middling;
8
9/// Middleware is an adapter between a backend and an application itself.
10pub trait Middleware<Init, UpdateContext, OnRender, Event, EventContext> {
11 /// Handle the initialization event.
12 fn on_init(&mut self, init: &mut Init);
13
14 /// Handle the update tick.
15 fn on_update(&mut self, context: &mut UpdateContext);
16
17 /// Handle render call, draw on the provided surface.
18 fn on_render(&mut self, surface: &mut OnRender);
19
20 /// Handle the backend event.
21 fn on_event(&mut self, event: Event, event_context: &mut EventContext) -> Option<Event>;
22}