diff --git a/src/event.rs b/src/event.rs index 13b3a63..21823f0 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,3 +1,5 @@ +//! User-input events and their effects. + use std::rc::Rc; /// Callback is a function that can be triggered by an event. diff --git a/src/lib.rs b/src/lib.rs index d7ccc87..9d7cf44 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,31 @@ +//! # Cursive +//! +//! Cursive is a TUI library built on top of ncurses-rs. +//! It allows to easily build layouts for text-based applications. +//! +//! ## Example +//! ``` +//! extern crate cursive; +//! +//! use cursive::Cursive; +//! use cursive::view::TextView; +//! +//! fn main() { +//! let mut siv = Cursive::new(); +//! +//! siv.add_layer(TextView::new("Hello World!\nPress q to quit.")); +//! +//! siv.add_global_callback('q' as i32, |s| s.quit()); +//! +//! siv.run(); +//! } +//! ``` + extern crate ncurses; -/// User-input events and their effects. pub mod event; -/// Defines various views to use when creating the layout. pub mod view; -/// Makes drawing on ncurses windows easier. pub mod printer; -/// 2D points. pub mod vec2; mod box_view; mod stack_view; diff --git a/src/printer.rs b/src/printer.rs index 8afb7d9..1fb7257 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -1,3 +1,5 @@ +//! Makes drawing on ncurses windows easier. + use ncurses; use vec2::{Vec2,ToVec2}; diff --git a/src/vec2.rs b/src/vec2.rs index fe99e48..a4464eb 100644 --- a/src/vec2.rs +++ b/src/vec2.rs @@ -1,3 +1,5 @@ +//! 2D points. + use std::ops::{Add, Sub}; use std::cmp::min; diff --git a/src/view.rs b/src/view.rs index 20016e8..00a4a98 100644 --- a/src/view.rs +++ b/src/view.rs @@ -1,3 +1,5 @@ +//! Defines various views to use when creating the layout. + use event::EventResult; pub use box_view::BoxView;