Struct crossterm::Crossterm[][src]

pub struct Crossterm { /* fields omitted */ }

This type could be used to access the cursor, terminal, color, input, styling module more easily. You need to pass a reference to the screen where on you want to perform the actions to the Crossterm type.

If you want to use the default screen you could do it like this:

extern crate crossterm;
use crossterm::{Crossterm, Screen};

let crossterm = Crossterm::new(&Screen::default());
let cursor = crossterm.cursor();

If you want to perform actions on the AlternateScreen make sure to pass a reference to the screen of the AlternateScreen.

extern crate crossterm;
use crossterm::{Crossterm, Screen};

let main_screen = Screen::default();

if let Ok(alternate_srceen) = main_screen.enable_alternate_modes(false)
{
   let crossterm = Crossterm::new(&alternate_screen.screen);
   let cursor = crossterm.cursor();
}

Methods

impl<'crossterm> Crossterm
[src]

Create a new instance of Crossterm

Get an TerminalCursor implementation whereon cursor related actions can be performed.

extern crate crossterm;
use crossterm::{Crossterm, Screen};

let crossterm = Crossterm::new(&Screen::default());
let cursor = crossterm.cursor();

Get an TerminalInput implementation whereon terminal related actions can be performed.

extern crate crossterm;
use crossterm::{Crossterm, Screen};
use crossterm::terminal;

let crossterm = Crossterm::new(&Screen::default());
let input = crossterm.input();

Get an Terminal implementation whereon terminal related actions can be performed.

extern crate crossterm;
use crossterm::{Crossterm, Screen};

let crossterm = Crossterm::new(&Screen::default());
let mut terminal = crossterm.terminal();

Get an TerminalColor implementation whereon color related actions can be performed.

extern crate crossterm;
use crossterm::{Crossterm, Screen};

let crossterm = Crossterm::new(&Screen::default());
let mut terminal = crossterm.terminal();

This could be used to style an Displayable type with colors and attributes.

extern crate crossterm;
use crossterm::{Crossterm, Screen};

let crossterm = Crossterm::new(&Screen::default());

// get an styled object which could be painted to the terminal.
let styled_object = crossterm.style("Some Blue colored text on black background")
    .with(Color::Blue)
    .on(Color::Black);

// create an default screen.
let screen = Screen::default();

// print the styled font * times to the current screen.
for i in 1..10
{
    styled_object.paint(&screen);
}

Trait Implementations

impl From<Arc<TerminalOutput>> for Crossterm
[src]

Performs the conversion.

Auto Trait Implementations

impl Send for Crossterm

impl Sync for Crossterm