[][src]Module unsegen::base

Basic terminal rendering including Terminal setup, "slicing" using Windows, and formatted writing to Windows using Cursors.

Example:

use unsegen::base::*;
use std::io::stdout;
use std::fmt::Write;

let stdout = stdout();
let mut term = Terminal::new(stdout.lock());

{
    let win = term.create_root_window();
    let (left, mut right) = win.split(ColIndex::new(5)).unwrap();

    let (mut top, mut bottom) = left.split(RowIndex::new(2)).unwrap();

    top.fill(GraphemeCluster::try_from('X').unwrap());

    bottom.modify_default_style(StyleModifier::new().fg_color(Color::Green));
    bottom.fill(GraphemeCluster::try_from('O').unwrap());

    let mut cursor = Cursor::new(&mut right)
        .position(ColIndex::new(1), RowIndex::new(2))
        .wrapping_mode(WrappingMode::Wrap)
        .style_modifier(StyleModifier::new().bold(true).bg_color(Color::Red));

    writeln!(cursor, "Hi there!").unwrap();
}
term.present();

Re-exports

pub use self::basic_types::*;
pub use self::cursor::*;
pub use self::grapheme_cluster::*;
pub use self::style::*;
pub use self::terminal::*;
pub use self::window::*;

Modules

basic_types

Basic numeric semantic wrapper types for use in other parts of the library.

cursor

A Cursor can be used to render text to Windows and Window-like types.

grapheme_cluster

Types related to grapheme cluster in utf8 encoding.

style

Types related to the visual representation (i.e., style) of text when drawn to the terminal. This includes formatting (bold, italic, ...) and colors.

terminal

The entry point module for presenting data to the terminal.

window

Types associated with Windows, i.e., rectangular views into a terminal buffer.