pub struct TerminalSession { /* private fields */ }Expand description
A live pseudo-terminal session with typed VT state.
Implementations§
Source§impl TerminalSession
impl TerminalSession
Sourcepub fn spawn(options: SessionOptions) -> Result<Self, TerminalError>
pub fn spawn(options: SessionOptions) -> Result<Self, TerminalError>
Start a child process in a fresh native PTY.
Sourcepub fn send(&self, events: &[InputEvent]) -> Result<usize, TerminalError>
pub fn send(&self, events: &[InputEvent]) -> Result<usize, TerminalError>
Send a prevalidated batch of text and typed key events.
Sourcepub fn capture(
&self,
region: Option<CellRegion>,
) -> Result<ScreenCapture, TerminalError>
pub fn capture( &self, region: Option<CellRegion>, ) -> Result<ScreenCapture, TerminalError>
Capture the current screen, optionally including detailed cells.
Sourcepub fn resize(&self, rows: u16, columns: u16) -> Result<(), TerminalError>
pub fn resize(&self, rows: u16, columns: u16) -> Result<(), TerminalError>
Resize both the native PTY and the VT parser.
Sourcepub fn wait_idle(
&self,
quiet: Duration,
timeout: Duration,
) -> Result<WaitIdleResult, TerminalError>
pub fn wait_idle( &self, quiet: Duration, timeout: Duration, ) -> Result<WaitIdleResult, TerminalError>
Wait until no child output has arrived for quiet.
Sourcepub fn wait_idle_after(
&self,
after_revision: u64,
quiet: Duration,
timeout: Duration,
) -> Result<WaitIdleResult, TerminalError>
pub fn wait_idle_after( &self, after_revision: u64, quiet: Duration, timeout: Duration, ) -> Result<WaitIdleResult, TerminalError>
Wait for a state revision newer than after_revision, then for quiet.
This fences a send-then-capture sequence against output that was already quiet before the input was written. The wait remains notification-driven.
Sourcepub fn wait_exit(
&self,
timeout: Duration,
) -> Result<ProcessStatus, TerminalError>
pub fn wait_exit( &self, timeout: Duration, ) -> Result<ProcessStatus, TerminalError>
Wait for the child process to reach a terminal state.
Sourcepub fn end(&self, timeout: Duration) -> Result<ProcessStatus, TerminalError>
pub fn end(&self, timeout: Duration) -> Result<ProcessStatus, TerminalError>
Terminate the child, close terminal handles, and join worker threads.
Trait Implementations§
Source§impl Drop for TerminalSession
impl Drop for TerminalSession
Auto Trait Implementations§
impl !Freeze for TerminalSession
impl RefUnwindSafe for TerminalSession
impl Send for TerminalSession
impl Sync for TerminalSession
impl Unpin for TerminalSession
impl UnsafeUnpin for TerminalSession
impl UnwindSafe for TerminalSession
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
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.