pub struct Session {
pub id: SessionId,
pub command: String,
pub created_at: DateTime<Utc>,
/* private fields */
}Expand description
Session state
Fields§
§id: SessionId§command: String§created_at: DateTime<Utc>Implementations§
Source§impl Session
impl Session
Sourcepub fn is_running(&mut self) -> bool
pub fn is_running(&mut self) -> bool
Check if process is running
Sourcepub fn update(&mut self) -> Result<(), SessionError>
pub fn update(&mut self) -> Result<(), SessionError>
Process any pending PTY output and update the terminal
Sourcepub fn screen_text(&self) -> String
pub fn screen_text(&self) -> String
Get screen text
Sourcepub fn screen_buffer(&self) -> ScreenBuffer
pub fn screen_buffer(&self) -> ScreenBuffer
Get screen buffer with style data
Sourcepub fn cursor(&self) -> CursorPosition
pub fn cursor(&self) -> CursorPosition
Get cursor position
Sourcepub fn detect_elements(&mut self) -> &[Element]
pub fn detect_elements(&mut self) -> &[Element]
Detect elements and cache them
Sourcepub fn find_element(&self, element_ref: &str) -> Option<&Element>
pub fn find_element(&self, element_ref: &str) -> Option<&Element>
Find element by ref
Sourcepub fn keydown(&mut self, key: &str) -> Result<(), SessionError>
pub fn keydown(&mut self, key: &str) -> Result<(), SessionError>
Hold a modifier key down
This tracks the modifier state for subsequent keystrokes. In PTY terminals, modifier keys don’t have separate “down” events - they’re combined with other keys. This method allows sequences like: keydown(“Shift”) -> click(@item1) -> click(@item2) -> keyup(“Shift”)
Sourcepub fn click(&mut self, element_ref: &str) -> Result<(), SessionError>
pub fn click(&mut self, element_ref: &str) -> Result<(), SessionError>
Click an element (move cursor and press Enter/Space)
Sourcepub fn fill(
&mut self,
element_ref: &str,
value: &str,
) -> Result<(), SessionError>
pub fn fill( &mut self, element_ref: &str, value: &str, ) -> Result<(), SessionError>
Fill an input with a value
Sourcepub fn kill(&mut self) -> Result<(), SessionError>
pub fn kill(&mut self) -> Result<(), SessionError>
Kill the session
Sourcepub fn pty_try_read(
&self,
buf: &mut [u8],
timeout_ms: i32,
) -> Result<usize, SessionError>
pub fn pty_try_read( &self, buf: &mut [u8], timeout_ms: i32, ) -> Result<usize, SessionError>
Read from PTY with timeout (for attach mode)
Sourcepub fn pty_reader_fd(&self) -> RawFd
pub fn pty_reader_fd(&self) -> RawFd
Get the PTY reader file descriptor (for polling in attach mode)
Sourcepub fn start_recording(&mut self)
pub fn start_recording(&mut self)
Start recording
Sourcepub fn stop_recording(&mut self) -> Vec<RecordingFrame>
pub fn stop_recording(&mut self) -> Vec<RecordingFrame>
Stop recording and return captured frames
Sourcepub fn recording_status(&self) -> RecordingStatus
pub fn recording_status(&self) -> RecordingStatus
Get recording status
Sourcepub fn capture_frame(&mut self)
pub fn capture_frame(&mut self)
Capture a recording frame if recording is active
Sourcepub fn start_trace(&mut self)
pub fn start_trace(&mut self)
Start tracing
Sourcepub fn stop_trace(&mut self)
pub fn stop_trace(&mut self)
Stop tracing
Sourcepub fn is_tracing(&self) -> bool
pub fn is_tracing(&self) -> bool
Check if tracing is active
Sourcepub fn add_trace_entry(&mut self, action: &str, details: Option<&str>)
pub fn add_trace_entry(&mut self, action: &str, details: Option<&str>)
Add a trace entry
Sourcepub fn get_trace_entries(&self, count: usize) -> Vec<TraceEntry>
pub fn get_trace_entries(&self, count: usize) -> Vec<TraceEntry>
Get recent trace entries
Sourcepub fn get_errors(&self, count: usize) -> Vec<ErrorEntry>
pub fn get_errors(&self, count: usize) -> Vec<ErrorEntry>
Get recent errors
Sourcepub fn error_count(&self) -> usize
pub fn error_count(&self) -> usize
Get total error count
Sourcepub fn clear_errors(&mut self)
pub fn clear_errors(&mut self)
Clear all errors
Sourcepub fn clear_console(&mut self)
pub fn clear_console(&mut self)
Clear console (resets terminal screen buffer)
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl !Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl !UnwindSafe for Session
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.