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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! # ANSI Escape Sequence
//!
//! Every sequence implements the standard library [`Display`](https://doc.rust-lang.org/std/fmt/trait.Display.html)
//! trait. It means that you can use macros like `format!`, `write!` to work with them.
//!
//! ## Examples
//!
//! Retrieve the sequence as a `String`:
//!
//! ```rust
//! use anes::SaveCursorPosition;
//!
//! let string = format!("{}", SaveCursorPosition);
//! assert_eq!(&string, "\x1B7");
//! ```
//!
//! Use the sequence on the standard output:
//!
//! ```rust
//! use std::io::{Result, Write};
//!
//! fn main() -> Result<()> {
//!     let mut stdout = std::io::stdout();
//!     write!(stdout, "{}", anes::SaveCursorPosition)?;
//!     write!(stdout, "{}", anes::RestoreCursorPosition)?;
//!     stdout.flush()?;
//!     Ok(())
//! }
//! ```

#![warn(rust_2018_idioms)]
#![deny(unused_imports, unused_must_use)]

pub use self::{
    buffer::{
        ClearBuffer, ClearLine, ScrollBufferDown, ScrollBufferUp, SwitchBufferToAlternate,
        SwitchBufferToNormal,
    },
    cursor::{
        DisableCursorBlinking, EnableCursorBlinking, HideCursor, MoveCursorDown, MoveCursorLeft,
        MoveCursorRight, MoveCursorTo, MoveCursorToColumn, MoveCursorToNextLine,
        MoveCursorToPreviousLine, MoveCursorUp, RestoreCursorPosition, SaveCursorPosition,
        ShowCursor,
    },
    terminal::ResizeTextArea,
};

// Keep it first to load all the macros before other modules.
#[macro_use]
mod macros;

mod buffer;
mod cursor;
mod terminal;