1 use std::{io, sync::MutexGuard}; 2 3 use crate::utils::ui::{event::WarpUiCallBackType, uicore::UiCore}; 4 5 use super::mode::ModeType; 6 7 pub enum StateCallback { 8 None, 9 Reset, 10 Exit(ModeType), 11 } 12 13 pub trait StateMachine { handle(&mut self, ui: &mut MutexGuard<UiCore>) -> io::Result<WarpUiCallBackType>14 fn handle(&mut self, ui: &mut MutexGuard<UiCore>) -> io::Result<WarpUiCallBackType>; exit(&mut self, callback: WarpUiCallBackType) -> io::Result<WarpUiCallBackType>15 fn exit(&mut self, callback: WarpUiCallBackType) -> io::Result<WarpUiCallBackType>; reset(&mut self)16 fn reset(&mut self); 17 } 18