Struct View

Source
pub struct View {
    pub next_bytes: Vec<u8>,
    pub prev_screen_time: Instant,
    pub review_cursor_position: (u16, u16),
    /* private fields */
}

Fields§

§next_bytes: Vec<u8>§prev_screen_time: Instant§review_cursor_position: (u16, u16)

Implementations§

Source§

impl View

Source

pub fn new(rows: u16, cols: u16) -> Self

Source

pub fn process_changes(&mut self, buf: &[u8])

Processes new changes, updating the internal screen representation

Source

pub fn finalize_changes(&mut self)

Advances the previous screen to match the current one, and sets its update time to now

Source

pub fn screen(&self) -> &Screen

Gets the current screen backing this view

Source

pub fn prev_screen(&self) -> &Screen

Gets the previous screen backing this view

Source

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

Gets the size of this view

Source

pub fn set_size(&mut self, rows: u16, cols: u16)

Resizes this view

Source

pub fn review_cursor_indentation_level(&mut self) -> (u16, bool)

Gets the indentation level of the line under the review cursor, and whether it’s changed since the last time this method was called.

Source

pub fn application_cursor_indentation_level(&mut self) -> (u16, bool)

Gets the indentation level of the line under the application cursor, and whether it’s changed since the last time this method was called.

Source

pub fn review_cursor_up(&mut self, skip_blank_lines: bool) -> bool

Moves the review cursor up a line. If skip_blank_lines is true, the review cursor will move up to the previous non blank line, or remain in place if this is the first non blank line. This method will return true only if the cursor moved.

Source

pub fn review_cursor_down(&mut self, skip_blank_lines: bool) -> bool

Moves the review cursor down a line. If skip_blank_lines is true, the review cursor will move down to the next non blank line, or remain in place if this is the last non blank line. This method will return true only if the cursor moved.

Source

pub fn review_cursor_prev_word(&mut self) -> bool

Moves the cursor to the start of the previous word, or the beginning of the line if the cursor is in or before the first word. This method will return true only if the cursor moved to a different word.

Source

pub fn review_cursor_next_word(&mut self) -> bool

Moves the cursor to the start of the next word, or the end of the line if the cursor is in or past the last word. This method will return true only if the cursor moved to a different word.

Source

pub fn review_cursor_left(&mut self) -> bool

Moves the review cursor left a column. If the next cell continues a wide character, it will be skipped. This method will return true only if the cursor moved.

Source

pub fn review_cursor_right(&mut self) -> bool

Moves the review cursor right a column. If the next cell continues a wide character, it will be skipped. This method will return true only if the cursor moved.

Source

pub fn line(&self, row: u16) -> String

Returns the entire line at the specified row.

Source

pub fn word(&self, row: u16, col: u16) -> String

Returns the word at the specified coordinates.

Source

pub fn character(&self, row: u16, col: u16) -> String

Returns the character at the specified coordinates.

Auto Trait Implementations§

§

impl Freeze for View

§

impl RefUnwindSafe for View

§

impl Send for View

§

impl Sync for View

§

impl Unpin for View

§

impl UnwindSafe for View

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.