use std::fmt::Debug;
use std::io;
use console::Term;
pub trait TermLike: Debug + Send + Sync {
fn width(&self) -> u16;
fn move_cursor_up(&self, n: usize) -> io::Result<()>;
fn move_cursor_down(&self, n: usize) -> io::Result<()>;
fn move_cursor_right(&self, n: usize) -> io::Result<()>;
fn move_cursor_left(&self, n: usize) -> io::Result<()>;
fn write_line(&self, s: &str) -> io::Result<()>;
fn write_str(&self, s: &str) -> io::Result<()>;
fn clear_line(&self) -> io::Result<()>;
fn flush(&self) -> io::Result<()>;
}
impl TermLike for Term {
fn width(&self) -> u16 {
self.size().1
}
fn move_cursor_up(&self, n: usize) -> io::Result<()> {
self.move_cursor_up(n)
}
fn move_cursor_down(&self, n: usize) -> io::Result<()> {
self.move_cursor_down(n)
}
fn move_cursor_right(&self, n: usize) -> io::Result<()> {
self.move_cursor_right(n)
}
fn move_cursor_left(&self, n: usize) -> io::Result<()> {
self.move_cursor_left(n)
}
fn write_line(&self, s: &str) -> io::Result<()> {
self.write_line(s)
}
fn write_str(&self, s: &str) -> io::Result<()> {
self.write_str(s)
}
fn clear_line(&self) -> io::Result<()> {
self.clear_line()
}
fn flush(&self) -> io::Result<()> {
self.flush()
}
}