pub struct ScriptedTerminal { /* private fields */ }Expand description
A scripted, in-memory terminal that replays canned input and captures output.
Implementations§
Source§impl ScriptedTerminal
impl ScriptedTerminal
Sourcepub fn key_driven() -> Self
pub fn key_driven() -> Self
A key-driven scripted terminal (advertises key input, like a raw TTY).
Sourcepub fn line_driven() -> Self
pub fn line_driven() -> Self
A line-driven scripted terminal (advertises line input, like cooked stdio).
Sourcepub fn with_line(self, line: impl Into<String>) -> Self
pub fn with_line(self, line: impl Into<String>) -> Self
Queue one input line (line-driven scripts).
Sourcepub fn with_lines<I, S>(self, lines: I) -> Self
pub fn with_lines<I, S>(self, lines: I) -> Self
Queue several input lines in order.
Sourcepub fn with_keys<I>(self, keys: I) -> Selfwhere
I: IntoIterator<Item = Key>,
pub fn with_keys<I>(self, keys: I) -> Selfwhere
I: IntoIterator<Item = Key>,
Queue several keystrokes in order.
Sourcepub const fn is_interactive(&self) -> bool
pub const fn is_interactive(&self) -> bool
Whether the terminal is currently in interactive (raw) mode.
Trait Implementations§
Source§impl Debug for ScriptedTerminal
impl Debug for ScriptedTerminal
Source§impl Default for ScriptedTerminal
impl Default for ScriptedTerminal
Source§fn default() -> ScriptedTerminal
fn default() -> ScriptedTerminal
Returns the “default value” for a type. Read more
Source§impl Terminal for ScriptedTerminal
impl Terminal for ScriptedTerminal
Source§fn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
The interaction model this terminal supports.
Source§fn read_line(&mut self) -> AppResult<Option<String>>
fn read_line(&mut self) -> AppResult<Option<String>>
Read one whole line (line-driven terminals). Read more
Source§fn read_key(&mut self) -> AppResult<Key>
fn read_key(&mut self) -> AppResult<Key>
Read one decoded keystroke (key-driven terminals). Read more
Source§fn write(&mut self, text: &str) -> AppResult<()>
fn write(&mut self, text: &str) -> AppResult<()>
Write
text verbatim (no trailing newline). Read moreSource§fn write_line(&mut self, text: &str) -> AppResult<()>
fn write_line(&mut self, text: &str) -> AppResult<()>
Write
text followed by a newline (a carriage return + line feed in raw
mode). Read moreSource§fn clear_last_lines(&mut self, _count: u16) -> AppResult<()>
fn clear_last_lines(&mut self, _count: u16) -> AppResult<()>
Move the cursor up
count lines and clear from there down, so the next
frame overwrites the previous one. A no-op for line-driven terminals. Read moreAuto Trait Implementations§
impl Freeze for ScriptedTerminal
impl RefUnwindSafe for ScriptedTerminal
impl Send for ScriptedTerminal
impl Sync for ScriptedTerminal
impl Unpin for ScriptedTerminal
impl UnsafeUnpin for ScriptedTerminal
impl UnwindSafe for ScriptedTerminal
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