pub struct Parser { /* private fields */ }
Expand description
A parser for terminal output which produces an in-memory representation of the terminal contents.
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn new(rows: u16, cols: u16, scrollback_len: usize) -> Self
pub fn new(rows: u16, cols: u16, scrollback_len: usize) -> Self
Creates a new terminal parser of the given size and with the given amount of scrollback.
Sourcepub fn process(&mut self, bytes: &[u8])
pub fn process(&mut self, bytes: &[u8])
Processes the contents of the given byte string, and updates the in-memory terminal state.
Sourcepub fn set_scrollback(&mut self, rows: usize)
pub fn set_scrollback(&mut self, rows: usize)
Scrolls to the given position in the scrollback.
This position indicates the offset from the top of the screen, and
should be 0
to put the normal screen in view.
This affects the return values of methods called on parser.screen()
:
for instance, parser.screen().cell(0, 0)
will return the top left
corner of the screen after taking the scrollback offset into account.
It does not affect parser.process()
at all.
The value given will be clamped to the actual size of the scrollback.
Trait Implementations§
Source§impl Write for Parser
impl Write for Parser
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)