use std::error::Error; use async_trait::async_trait; /* Functions the input subsystem needs to perform: - init - register and unregister event handlers for: - mouse movement - keydown, keyup, keypress - clicks */ #[async_trait] pub trait InputSubsystem { async fn init() -> Result> where Self: Sized; async fn register_on_mouse_move(&mut self, id: &str, callback: dyn FnMut(OnMouseMoveEvent)) -> Result<(), Box>; async fn unregister_on_mouse_move(&mut self, id: &str) -> Result<(), Box>; async fn register_on_key_down(&mut self, id: &str, callback: dyn FnMut(OnKeyDownEvent)) -> Result<(), Box>; async fn unregister_on_key_down(&mut self, id: &str) -> Result<(), Box>; async fn register_on_key_up(&mut self, id: &str, callback: dyn FnMut(OnKeyUpEvent)) -> Result<(), Box>; async fn unregister_on_key_up(&mut self, id: &str) -> Result<(), Box>; async fn register_on_keypress(&mut self, id: &str, callback: dyn FnMut(OnKeypressEvent)) -> Result<(), Box>; async fn unregister_on_keypress(&mut self, id: &str) -> Result<(), Box>; async fn register_on_click(&mut self, id: &str, callback: dyn FnMut(OnClickEvent)) -> Result<(), Box>; async fn unregister_on_click(&mut self, id: &str) -> Result<(), Box>; } pub struct OnMouseMoveEvent {} pub struct OnKeyDownEvent {} pub struct OnKeyUpEvent {} pub struct OnKeypressEvent {} pub struct OnClickEvent {}