Struct tuikit::term::Term[][src]

pub struct Term<UserEvent: Send + 'static = ()> { /* fields omitted */ }

Implementations

impl<UserEvent: Send + 'static> Term<UserEvent>[src]

pub fn with_height(height: TermHeight) -> Result<Term<UserEvent>>[src]

Create a Term with height specified.

Internally if the calculated height would fill the whole screen, Alternate Screen will be enabled, otherwise only part of the screen will be used.

If the preferred height is larger than the current screen, whole screen is used.

use tuikit::term::{Term, TermHeight};

let term: Term<()> = Term::with_height(TermHeight::Percent(30)).unwrap(); // 30% of the terminal height
let term: Term<()> = Term::with_height(TermHeight::Fixed(20)).unwrap(); // fixed 20 lines

pub fn new() -> Result<Term<UserEvent>>[src]

Create a Term (with 100% height)

use tuikit::term::{Term, TermHeight};

let term: Term<()> = Term::new().unwrap();
let term: Term<()> = Term::with_height(TermHeight::Percent(100)).unwrap();

pub fn with_options(options: TermOptions) -> Result<Term<UserEvent>>[src]

Create a Term with custom options

use tuikit::term::{Term, TermHeight, TermOptions};

let term: Term<()> = Term::with_options(TermOptions::default().height(TermHeight::Percent(100))).unwrap();

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

restart the terminal if it had been stopped

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

Pause the Term

This function will cause the Term to give away the control to the terminal(such as listening to the key strokes). After the Term was "paused", poll_event will block indefinitely and recover after the Term was restarted.

pub fn peek_event(&self, timeout: Duration) -> Result<Event<UserEvent>>[src]

Wait an event up to timeout and return it

pub fn poll_event(&self) -> Result<Event<UserEvent>>[src]

Wait for an event indefinitely and return it

pub fn send_event(&self, event: Event<UserEvent>) -> Result<()>[src]

An interface to inject event to the terminal's event queue

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

Sync internal buffer with terminal

pub fn term_size(&self) -> Result<(usize, usize)>[src]

Return the printable size(width, height) of the term

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

Clear internal buffer

pub fn put_cell(&self, row: usize, col: usize, cell: Cell) -> Result<usize>[src]

Change a cell of position (row, col) to cell

pub fn print(&self, row: usize, col: usize, content: &str) -> Result<usize>[src]

Print content starting with position (row, col)

pub fn print_with_attr(
    &self,
    row: usize,
    col: usize,
    content: &str,
    attr: impl Into<Attr>
) -> Result<usize>
[src]

print content starting with position (row, col) with attr

pub fn set_cursor(&self, row: usize, col: usize) -> Result<()>[src]

Set cursor position to (row, col), and show the cursor

pub fn show_cursor(&self, show: bool) -> Result<()>[src]

show/hide cursor, set show to false to hide the cursor

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

Enable mouse support

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

Disable mouse support

pub fn clear_on_exit(&self, clear: bool) -> Result<()>[src]

Whether to clear the terminal upon exiting. Defaults to true.

pub fn draw(&self, draw: &dyn Draw) -> Result<()>[src]

Trait Implementations

impl<'a, UserEvent: Send + 'static> Drop for Term<UserEvent>[src]

Auto Trait Implementations

impl<UserEvent = ()> !RefUnwindSafe for Term<UserEvent>[src]

impl<UserEvent> Send for Term<UserEvent>[src]

impl<UserEvent> Sync for Term<UserEvent>[src]

impl<UserEvent> Unpin for Term<UserEvent>[src]

impl<UserEvent = ()> !UnwindSafe for Term<UserEvent>[src]

Blanket Implementations

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

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

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

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.