pub struct SessionContext { /* private fields */ }Expand description
What has run in a session so far.
Bookkeeping only — it does not configure anything. A session holds no shell
between calls (every execute spawns its own cmd /c / sh -c), so there is
no working directory or environment for it to carry: both are decided per
execute. This type once held a cwd and an env that nothing read, and a
StateProbe helper for recovering them from a persistent shell that does
not exist here.
Implementations§
Source§impl SessionContext
impl SessionContext
Sourcepub fn last_command(&self) -> Option<&str>
pub fn last_command(&self) -> Option<&str>
Get the last command executed.
Sourcepub fn last_exit_code(&self) -> Option<i32>
pub fn last_exit_code(&self) -> Option<i32>
Get the exit code of the last command.
Sourcepub fn execution_count(&self) -> u64
pub fn execution_count(&self) -> u64
Get the number of commands executed.
Sourcepub fn record_execution(
&mut self,
command: impl Into<String>,
exit_code: Option<i32>,
)
pub fn record_execution( &mut self, command: impl Into<String>, exit_code: Option<i32>, )
Record a command execution result.
Sourcepub fn last_succeeded(&self) -> bool
pub fn last_succeeded(&self) -> bool
Check if the last command succeeded.
Sourcepub fn last_failed(&self) -> bool
pub fn last_failed(&self) -> bool
Check if the last command failed.
Trait Implementations§
Source§impl Clone for SessionContext
impl Clone for SessionContext
Source§fn clone(&self) -> SessionContext
fn clone(&self) -> SessionContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionContext
impl Debug for SessionContext
Source§impl Default for SessionContext
impl Default for SessionContext
Source§fn default() -> SessionContext
fn default() -> SessionContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SessionContext
impl RefUnwindSafe for SessionContext
impl Send for SessionContext
impl Sync for SessionContext
impl Unpin for SessionContext
impl UnsafeUnpin for SessionContext
impl UnwindSafe for SessionContext
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