termion/
lib.rs

1//! Termion is a pure Rust, bindless library for low-level handling, manipulating
2//! and reading information about terminals. This provides a full-featured
3//! alternative to Termbox.
4//!
5//! Termion aims to be simple and yet expressive. It is bindless, meaning that it
6//! is not a front-end to some other library (e.g., ncurses or termbox), but a
7//! standalone library directly talking to the TTY.
8//!
9//! Supports Redox, Mac OS X, and Linux (or, in general, ANSI terminals).
10//!
11//! For more information refer to the [README](https://github.com/redox-os/termion).
12#![warn(missing_docs)]
13
14extern crate numtoa;
15
16#[cfg(target_os = "redox")]
17#[path="sys/redox/mod.rs"]
18mod sys;
19
20#[cfg(all(unix, not(target_os = "redox")))]
21#[path="sys/unix/mod.rs"]
22mod sys;
23
24pub use sys::size::terminal_size;
25pub use sys::tty::{is_tty, get_tty};
26
27mod async;
28pub use async::{AsyncReader, async_stdin};
29
30#[macro_use]
31mod macros;
32pub mod clear;
33pub mod color;
34pub mod cursor;
35pub mod event;
36pub mod input;
37pub mod raw;
38pub mod screen;
39pub mod scroll;
40pub mod style;
41
42#[cfg(test)]
43mod test {
44    use super::sys;
45
46    #[test]
47    fn test_get_terminal_attr() {
48        sys::attr::get_terminal_attr().unwrap();
49        sys::attr::get_terminal_attr().unwrap();
50        sys::attr::get_terminal_attr().unwrap();
51    }
52
53    #[test]
54    fn test_set_terminal_attr() {
55        let ios = sys::attr::get_terminal_attr().unwrap();
56        sys::attr::set_terminal_attr(&ios).unwrap();
57    }
58
59    #[test]
60    fn test_size() {
61        sys::size::terminal_size().unwrap();
62    }
63}