use std::io::{self, Write};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Screen;
impl Screen {
pub fn clear() -> io::Result<()> {
let mut stdout = io::stdout();
stdout.write_all(b"\x1b[2J\x1b[H")?;
stdout.flush()
}
pub fn clear_to_end() -> io::Result<()> {
let mut stdout = io::stdout();
stdout.write_all(b"\x1b[J")?;
stdout.flush()
}
pub fn clear_line() -> io::Result<()> {
let mut stdout = io::stdout();
stdout.write_all(b"\x1b[2K")?;
stdout.flush()
}
pub fn clear_on<W: Write>(writer: &mut W) -> io::Result<()> {
writer.write_all(b"\x1b[2J\x1b[H")?;
writer.flush()
}
}