[][src]Function term_size::dimensions_stdout

pub fn dimensions_stdout() -> Option<(usize, usize)>

Query the current processes's output, returning its width and height as a number of characters. Returns None if the output isn't to a terminal.

Errors

Returns None if the output isn't to a terminal.

Example

To get the dimensions of your terminal window, simply use the following:

if let Some((w, h)) = term_size::dimensions() {
    println!("Width: {}\nHeight: {}", w, h);
} else {
    println!("Unable to get term size :(")
}