#[derive(Debug, Clone, Copy)] pub enum Direction { Up, Down, Left, Right, } pub fn move_cursor(direction: Direction, n: usize) { if n == 0 { return; } let code = match direction { Direction::Up => 'A', Direction::Down => 'B', Direction::Right => 'C', Direction::Left => 'D', }; print!("\x1b[{n}{code}"); } /// Represents a cursor position #[derive(Debug, Clone, Copy)] pub struct CursorPos { pub row: usize, pub col: usize, }