pub struct Parser<CB: Callbacks = ()> { /* private fields */ }Expand description
A parser for terminal output which produces an in-memory representation of the terminal contents.
Implementations§
Source§impl<CB: Callbacks> Parser<CB>
impl<CB: Callbacks> Parser<CB>
Sourcepub fn new_with_callbacks(
rows: u16,
cols: u16,
scrollback_len: usize,
callbacks: CB,
) -> Self
pub fn new_with_callbacks( rows: u16, cols: u16, scrollback_len: usize, callbacks: CB, ) -> Self
Creates a new terminal parser of the given size and with the given
amount of scrollback. Terminal events will be reported via method
calls on the provided Callbacks
implementation.
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 screen(&self) -> &Screen
pub fn screen(&self) -> &Screen
Returns a reference to a Screen object containing
the terminal state.
Sourcepub fn screen_mut(&mut self) -> &mut Screen
pub fn screen_mut(&mut self) -> &mut Screen
Returns a mutable reference to a Screen object
containing the terminal state.
Sourcepub fn callbacks(&self) -> &CB
pub fn callbacks(&self) -> &CB
Returns a reference to the Callbacks
state object passed into the constructor.
Sourcepub fn callbacks_mut(&mut self) -> &mut CB
pub fn callbacks_mut(&mut self) -> &mut CB
Returns a mutable reference to the
Callbacks state object passed into
the constructor.
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>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl<CB> Freeze for Parser<CB>where
CB: Freeze,
impl<CB> RefUnwindSafe for Parser<CB>where
CB: RefUnwindSafe,
impl<CB> Send for Parser<CB>where
CB: Send,
impl<CB> Sync for Parser<CB>where
CB: Sync,
impl<CB> Unpin for Parser<CB>where
CB: Unpin,
impl<CB> UnwindSafe for Parser<CB>where
CB: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more