pub mod benchmark; pub mod commands; pub mod console; pub mod simple_benchmark; pub use benchmark::*; pub use console::*; pub use simple_benchmark::*; use std::{any::Any, sync::Arc}; use crate::{prelude::Context, render::Area, DrawContext, View}; pub trait Engine { fn run) -> View + Send + Sync + 'static>(&self, component: F) { let cx = self.init(component); loop { self.render(&cx); self.render_delay(); } } fn init) -> View + Send + Sync + 'static>( &self, component: F, ) -> Arc; fn render(&self, cx: &Arc); fn render_delay(&self) { std::thread::sleep(std::time::Duration::from_millis(16)) } fn render_view(&self, area: &Area, view: &View) -> DrawContext; fn draw_context(&self, ctx: &DrawContext); fn executor(&self) -> Arc; } pub trait Command { fn as_any(&self) -> &dyn Any; } pub trait CommandExecutor: Send + Sync { fn execute_command(&self, command: &Arc) -> crate::Result<()>; }