[][src]Struct crossterm_cursor::TerminalCursor

pub struct TerminalCursor { /* fields omitted */ }

Allows you to preform actions with the terminal cursor.

Features:

  • Moving n times Up, Down, Left, Right
  • Goto a certain position
  • Get cursor position
  • Storing the current cursor position and resetting to that stored cursor position later
  • Hiding an showing the cursor
  • Control over blinking of the terminal cursor (only some terminals are supporting this)

Note that positions of the cursor are 0 -based witch means that the coordinates (cells) starts counting from 0

Check /examples/cursor in the library for more specific examples.

Methods

impl TerminalCursor[src]

pub fn new() -> TerminalCursor[src]

Create new TerminalCursor instance whereon cursor related actions can be performed.

pub fn goto(&self, x: u16, y: u16) -> Result<()>[src]

Goto some position (x,y) in the terminal.

Remarks

position is 0-based, which means we start counting at 0.

pub fn pos(&self) -> (u16, u16)[src]

Get current cursor position (x,y) in the terminal.

Remarks

position is 0-based, which means we start counting at 0.

pub fn move_up(&mut self, count: u16) -> &mut TerminalCursor[src]

Move the current cursor position n times up.

pub fn move_right(&mut self, count: u16) -> &mut TerminalCursor[src]

Move the current cursor position n times right.

pub fn move_down(&mut self, count: u16) -> &mut TerminalCursor[src]

Move the current cursor position n times down.

pub fn move_left(&mut self, count: u16) -> &mut TerminalCursor[src]

Move the current cursor position n times left.

pub fn save_position(&self) -> Result<()>[src]

Save cursor position for recall later.

Note that this position is stored program based not per instance of the Cursor struct.

pub fn reset_position(&self) -> Result<()>[src]

Return to saved cursor position

pub fn hide(&self) -> Result<()>[src]

Hide de cursor in the console.

pub fn show(&self) -> Result<()>[src]

Show the cursor in the console.

Enable or disable blinking of the terminal.

Remarks

Not all terminals are supporting this functionality. Windows versions lower than windows 10 also are not supporting this version.

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]