semtext/
lib.rs

1// lib.rs      semtext crate.
2//
3// Copyright (c) 2020  Douglas Lau
4//
5//! Semtext is a Rust library for building text user interfaces, or **TUI**s.
6//!
7//! ## Example
8//! ```no_run
9//! use semtext::{grid_area, input::Action, widget::Label, Screen, Widget};
10//!
11//! async fn async_main() -> Result<(), Box<dyn std::error::Error>> {
12//!     let mut screen = Screen::new()?;
13//!     let a = Label::new("Hello!").into_button();
14//!     let grid = grid_area!(
15//!         [. . .]
16//!         [. a .]
17//!         [. . .]
18//!     )?;
19//!     while screen.step(&grid).await? != Action::Quit() {}
20//!     Ok(())
21//! }
22//!
23//! fn main() -> Result<(), Box<dyn std::error::Error>> {
24//!     futures::executor::block_on(async_main())
25//! }
26//! ```
27
28#![forbid(unsafe_code)]
29
30mod error;
31pub mod input;
32pub mod layout;
33mod screen;
34pub mod text;
35mod traits;
36pub mod widget;
37
38pub use crate::error::Error;
39pub(crate) use crate::error::Result;
40pub use crate::screen::Screen;
41pub use crate::traits::Widget;