Function hanbun::size[][src]

pub fn size() -> Result<(usize, usize), TerminalSizeError>

Returns the terminal’s width and height.

Examples

if let Ok((width, height)) = hanbun::size() {
    println!("Your terminal has {} cells!", width*height);
} else {
    eprintln!("Failed to get terminal size!");
}

Errors

May return TerminalSizeError if the operation failed.