pub struct Term<W: PtyWriter> { /* private fields */ }Expand description
An in-memory terminal emulator.
Implementations§
Source§impl<W: PtyWriter> Term<W>
impl<W: PtyWriter> Term<W>
Sourcepub fn new(lines: u16, columns: u16, pty_writer: W) -> Self
pub fn new(lines: u16, columns: u16, pty_writer: W) -> Self
Create a new emulated terminal with a cell matrix of lines by columns.
pty_writer is used to send output from the emulated terminal in reponse to ANSI requests.
Use VoidPtyWriter if you do not need to send responses to status requests.
Sourcepub fn process_with_callback(
&mut self,
byte: u8,
cb: impl FnMut(&Self, AnsiSignal),
)
pub fn process_with_callback( &mut self, byte: u8, cb: impl FnMut(&Self, AnsiSignal), )
Process one byte of ANSI-escaped terminal data. Some ANSI signals will trigger callback
cb to be called with a reference to the terminal and the signal that triggered the call,
right before applying the result of the ANSI signal to the terminal. This allows grabbing a
snapshot of the the terminal screen contents before application of the signal.
See also AnsiSignal.
Sourcepub fn resize(&mut self, lines: u16, columns: u16)
pub fn resize(&mut self, lines: u16, columns: u16)
Resize the terminal screen to the specified dimension.
Sourcepub fn current_screen(&self) -> Screen
pub fn current_screen(&self) -> Screen
Get a snapshot of the current terminal screen.
Auto Trait Implementations§
impl<W> !Freeze for Term<W>
impl<W> !RefUnwindSafe for Term<W>
impl<W> Send for Term<W>where
W: Send,
impl<W> !Sync for Term<W>
impl<W> Unpin for Term<W>where
W: Unpin,
impl<W> UnwindSafe for Term<W>where
W: 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