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]
impl<'crossterm> Crosstermpub fn new(screen: &Screen) -> Crossterm[src]
pub fn new(screen: &Screen) -> CrosstermCreate a new instance of Crossterm
pub fn cursor(&self) -> TerminalCursor[src]
pub fn cursor(&self) -> TerminalCursorGet 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();
pub fn input(&self) -> TerminalInput[src]
pub fn input(&self) -> TerminalInputGet 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();
pub fn terminal(&self) -> Terminal[src]
pub fn terminal(&self) -> TerminalGet 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();
pub fn color(&self) -> TerminalColor[src]
pub fn color(&self) -> TerminalColorGet 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();
pub fn style<D>(&self, val: D) -> StyledObject<D> where
D: Display, [src]
pub fn style<D>(&self, val: D) -> StyledObject<D> where
D: Display, 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]
impl From<Arc<TerminalOutput>> for Crosstermfn from(stdout: Arc<TerminalOutput>) -> Self[src]
fn from(stdout: Arc<TerminalOutput>) -> SelfPerforms the conversion.