use crate::canvas::{Event, Geometry, Size}; use iced_native::MouseCursor; pub trait Program { fn update(&mut self, _event: Event, _bounds: Size) -> Option { None } fn draw(&self, bounds: Size) -> Vec; fn mouse_cursor(&self, _bounds: Size) -> MouseCursor { MouseCursor::default() } } impl Program for &mut T where T: Program, { fn update(&mut self, event: Event, bounds: Size) -> Option { T::update(self, event, bounds) } fn draw(&self, bounds: Size) -> Vec { T::draw(self, bounds) } fn mouse_cursor(&self, bounds: Size) -> MouseCursor { T::mouse_cursor(self, bounds) } }