Struct libterm::cursor::Cursor

source ·
pub struct Cursor {
    pub offset_from_end: usize,
    pub underlying_char: u8,
    /* private fields */
}
Expand description

The cursor structure used in the terminal. A cursor is a special symbol shown in the text box of a terminal. It indicates the position of character where the next input would be put or the delete operation works on. Terminal invokes its display method in a loop to let a cursor blink.

Fields§

§offset_from_end: usize

The position of the cursor relative to the end of terminal text in number of characters.

§underlying_char: u8

The underlying character at the position of the cursor. It is shown when the cursor is unseen.

Implementations§

source§

impl Cursor

source

pub fn reset(&mut self)

Reset the state of the cursor as unseen

source

pub fn enable(&mut self)

Enable a cursor

source

pub fn disable(&mut self)

Disable a cursor

Let a cursor blink. It is invoked in a loop.

source

pub fn show(&self) -> bool

Whether a cursor is seen

source

pub fn display<P: Pixel>( &mut self, coordinate: Coord, column: usize, line: usize, framebuffer: &mut Framebuffer<P> ) -> Result<Rectangle, &'static str>where Color: Into<P>,

Display a cursor in a framebuffer

Arguments
  • coordinate: the start point of a textarea in the framebuffer.
  • column: the column of the cursor in the textarea.
  • line: the line of the cursor in the textarea.
  • framebuffer: the framebuffer to display the cursor in.

Returns a bounding box which wraps the cursor.

source

pub fn set_offset_from_end(&mut self, offset: usize)

Sets the position of the cursor relative to the end of the command

source

pub fn offset_from_end(&self) -> usize

Gets the position of the cursor relative to the end of the command

source

pub fn set_underlying_char(&mut self, c: u8)

Sets the character at the position of the cursor

source

pub fn underlying_char(&self) -> u8

Gets the character at the position of the cursor

Trait Implementations§

source§

impl Default for Cursor

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.