summaryrefslogtreecommitdiff
path: root/src/lib.rs
blob: b092b85b12e1950eab7672ba1931b090c310c6d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! This crate contains bindings to the C library [termio][1]. Most functions
//! wrapped are methods on the `Screen` or `Keyboard` structs, while others take
//! one of these structs as an argument. This organisation ensures that e.g. the
//! screen can only be redrawn while the double-buffered screen is actually
//! active, and that keys can only be read from the input while the input stream
//! is actually in raw mode.
//!
//! The `widgets` submodule contains the built-in widget modules in termio.
//!
//! All callbacks are `extern "C"` functions, and thus do not accept generic
//! `Fn` instances. This is due to a limitation of the original termio API.
//!
//! In this crate, terminal screen positions and sizes are represented using a
//! tuple `(x, y): (u32, u32)`. Positions are zero-based.
//!
//! The `KEY_` constants describe the return values from `Keyboard::get_key()`.
//! To create key combinations, e.g. ctrl-A, use addition, e.g. `KEY_CTRL +
//! 'A'`.
//!
//! **Please be aware that to get anything on the screen, you need to call
//! `redraw()`.**
//!
//! [1]: https://github.com/tomsmeding/termio

mod bindings;
mod util;

mod core;
pub mod widgets;

pub use crate::core::*;