termsize 0.1.4

Retrieves terminal size
Documentation

termsize

Build Status Build status Coverage Status

because terminal size matters

Termsize is a rust crate providing a multi-platform interface for resolving your terminal's current size in rows and columns. On most unix systems, this is similar invoking the stty(1) program, requesting the terminal size.

install

add the following to your Cargo.toml file

[dependencies]
termsize = "0.1"

api docs

Find them here

usage

Termize provides one function, get, which returns a termsize::Size struct exposing two fields: rows and cols.

extern crate termsize;

pub fn main() {
  termsize::get().map(|size| {
    println!("rows {} cols {}", size.rows, size.cols)
  });
}

Doug Tangren (softprops) 2015