pub struct Terminal { /* private fields */ }Expand description
A terminal instance wrapping a PTY.
Implementations§
Source§impl Terminal
impl Terminal
Sourcepub fn builder() -> TerminalBuilder
pub fn builder() -> TerminalBuilder
Create a new terminal builder.
Sourcepub async fn type_str(&self, text: &str) -> Result<&Self>
pub async fn type_str(&self, text: &str) -> Result<&Self>
Type a string of text into the terminal.
Sourcepub async fn mouse_move(
&self,
row: u16,
col: u16,
held_buttons: Vec<MouseButton>,
) -> Result<&Self>
pub async fn mouse_move( &self, row: u16, col: u16, held_buttons: Vec<MouseButton>, ) -> Result<&Self>
Move the mouse cursor (hover).
Note: Many TUIs ignore this unless mouse reporting is enabled.
Sourcepub async fn mouse_click(
&self,
row: u16,
col: u16,
button: MouseButton,
) -> Result<&Self>
pub async fn mouse_click( &self, row: u16, col: u16, button: MouseButton, ) -> Result<&Self>
Click a mouse button at the given cell position.
Sourcepub async fn mouse_down(
&self,
row: u16,
col: u16,
button: MouseButton,
) -> Result<&Self>
pub async fn mouse_down( &self, row: u16, col: u16, button: MouseButton, ) -> Result<&Self>
Press a mouse button at the given cell position.
Sourcepub async fn mouse_up(&self, row: u16, col: u16) -> Result<&Self>
pub async fn mouse_up(&self, row: u16, col: u16) -> Result<&Self>
Release any mouse button at the given cell position.
Sourcepub fn expect(&self, text: &str) -> ExpectBuilder<'_>
pub fn expect(&self, text: &str) -> ExpectBuilder<'_>
Wait for specific text to appear on screen.
Sourcepub fn expect_gone(&self, text: &str) -> ExpectBuilder<'_>
pub fn expect_gone(&self, text: &str) -> ExpectBuilder<'_>
Wait for specific text to disappear from screen.
Sourcepub fn expect_pattern(&self, pattern: &str) -> ExpectBuilder<'_>
pub fn expect_pattern(&self, pattern: &str) -> ExpectBuilder<'_>
Wait for a regex pattern to match on screen.
Sourcepub fn expect_pattern_gone(&self, pattern: &str) -> ExpectBuilder<'_>
pub fn expect_pattern_gone(&self, pattern: &str) -> ExpectBuilder<'_>
Wait for a regex pattern to stop matching on screen.
Sourcepub fn wait_cursor(&self, position: Position) -> ExpectBuilder<'_>
pub fn wait_cursor(&self, position: Position) -> ExpectBuilder<'_>
Wait for the cursor to reach a specific position.
Sourcepub fn wait_idle(&self, duration: Duration) -> ExpectBuilder<'_>
pub fn wait_idle(&self, duration: Duration) -> ExpectBuilder<'_>
Wait for the screen to stabilize (no changes for the given duration).
Sourcepub async fn has_exited(&self) -> bool
pub async fn has_exited(&self) -> bool
Check if the process has exited.
Sourcepub fn config(&self) -> &TerminalConfig
pub fn config(&self) -> &TerminalConfig
Get the terminal configuration.
Sourcepub async fn screenshot(&self) -> Screenshot
pub async fn screenshot(&self) -> Screenshot
Take a screenshot of the current screen.
Returns a Screenshot that can be saved to a file or converted to PNG bytes.
Auto Trait Implementations§
impl Freeze for Terminal
impl !RefUnwindSafe for Terminal
impl Send for Terminal
impl Sync for Terminal
impl Unpin for Terminal
impl !UnwindSafe for Terminal
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.