Terminal

Struct Terminal 

Source
pub struct Terminal<'a, T: Write> {
    pub rel_size: (u16, u16),
    pub pix_size: (u16, u16),
    pub stdout: &'a mut T,
    pub x_pos: u16,
    pub y_pos: u16,
    pub cursor_mode: Cursor,
    pub screen_num: u8,
    pub mode: TermMode,
    /* private fields */
}
Expand description

Terminal control struct

Fields§

§rel_size: (u16, u16)§pix_size: (u16, u16)§stdout: &'a mut T§x_pos: u16§y_pos: u16§cursor_mode: Cursor§screen_num: u8§mode: TermMode

Implementations§

Source§

impl<'a, T: Write> Terminal<'a, T>

Source

pub fn new(stdout: &'a mut T) -> Result<Terminal<'_, T>, Error>

Source

pub fn print(&mut self, x: &str) -> Result<()>

Source

pub fn size_did_change(&mut self) -> bool

Source

pub fn enter_raw_mode(&mut self) -> Result<()>

Source

pub fn keys(&self, stdin: Stdin) -> KeyIterator

Source

pub fn switch_screen(&mut self) -> Result<()>

Source

pub fn switch_main(&mut self) -> Result<()>

Source

pub fn get_size(&self) -> (u16, u16)

Source

pub fn get_position(&self) -> (u16, u16)

Source§

impl<T: Write> Terminal<'_, T>

Source

pub fn set_cursor_to(&mut self, x_pos: u16, y_pos: u16) -> Result<()>

Source

pub fn get_cursor(&self) -> Result<(u16, u16)>

Source

pub fn show_cursor(&mut self) -> Result<()>

Source

pub fn hide_cursor(&mut self) -> Result<()>

Source

pub fn blinking_block(&mut self) -> Result<()>

Source

pub fn steady_block(&mut self) -> Result<()>

Source

pub fn blinking_underline(&mut self) -> Result<()>

Source

pub fn steady_underline(&mut self) -> Result<()>

Source

pub fn blinking_bar(&mut self) -> Result<()>

Source

pub fn steady_bar(&mut self) -> Result<()>

Source

pub fn reset_cursor(&mut self) -> Result<()>

Source§

impl<T: Write> Terminal<'_, T>

Source

pub fn clear_screen(&mut self) -> Result<()>

Source

pub fn clear_below_cursor(&mut self) -> Result<()>

Source

pub fn clear_above_cursor(&mut self) -> Result<()>

Source

pub fn clear_line(&mut self) -> Result<()>

Trait Implementations§

Source§

impl<T: Write> Debug for Terminal<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Write> Drop for Terminal<'_, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for Terminal<'a, T>

§

impl<'a, T> RefUnwindSafe for Terminal<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Terminal<'a, T>
where T: Send,

§

impl<'a, T> Sync for Terminal<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Terminal<'a, T>

§

impl<'a, T> !UnwindSafe for Terminal<'a, T>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.