use crate::*; use std::ops::{Add, Sub}; use std::cmp::{Ord, Eq, PartialEq}; /// Entry point for main loop pub trait App { fn run (self, context: T) -> Usually; } pub trait Number: Send + Sync + Copy + Add + Sub + Ord + PartialEq + Eq {} impl Number for T where T: Send + Sync + Copy + Add + Sub + Ord + PartialEq + Eq {} /// Platform backend. pub trait Engine: Sized { fn setup (&mut self) -> Usually<()> { Ok(()) } fn exited (&self) -> bool; fn teardown (&mut self) -> Usually<()> { Ok(()) } /// Unit of distance. type Unit: Number; type HandleInput; type Handled; type RenderInput; type Rendered; } pub trait HandleContext {} pub trait RenderContext {} submod! { collect component exit focus handle keymap layered layout render split }