Expand description
A simple utility for getting the size of a terminal.
Works on Linux, macOS, Windows, and illumos.
This crate requires a minimum Rust version of 1.63.0 (2022-08-11).
§Example
use terminal_size::{Width, Height, terminal_size};
let size = terminal_size();
if let Some((Width(w), Height(h))) = size {
println!("Your terminal is {} cols wide and {} lines tall", w, h);
} else {
println!("Unable to get terminal size");
}
Structs§
Functions§
- Returns the size of the terminal.
- Returns the size of the terminal using the given file descriptor, if available.
- terminal_
size_ ⚠using_ fd Deprecated Returns the size of the terminal using the given raw file descriptor, if available.