1//! System calls for getting the terminal size.
2//!
3//! Getting the terminal size is performed using an ioctl command that takes
4//! the file handle to the terminal -- which in this case, is stdout -- and
5//! populates a structure containing the values.
6//!
7//! The size is needed when the user wants the output formatted into columns:
8//! the default grid view, or the hybrid grid-details view.
9//!
10//! # Example
11//!
12//! To get the dimensions of your terminal window, simply use the following:
13//!
14//! ```no_run
15//! if let Some((w, h)) = termize::dimensions() {
16//! println!("Width: {}\nHeight: {}", w, h);
17//! } else {
18//! println!("Unable to get term size :(");
19//! }
20//! ```
21#![deny(
22 missing_docs,
23 missing_debug_implementations,
24 missing_copy_implementations,
25 trivial_casts,
26 unused_import_braces,
27 unused_allocation,
28 unused_qualifications,
29 trivial_numeric_casts
30)]
31
32// A facade to allow exposing functions depending on the platform
33mod platform;
34pub use crate::platform::{dimensions, dimensions_stderr, dimensions_stdin, dimensions_stdout};
35