pub struct Session {
pub header: SessionHeader,
pub commands: Vec<Command>,
pub footer: Option<SessionFooter>,
}Expand description
A complete recording session.
Contains the header (metadata), list of commands, and optional footer (None while still recording).
Fields§
§header: SessionHeaderSession metadata
commands: Vec<Command>Commands recorded in this session
Footer information (None while recording)
Implementations§
Source§impl Session
impl Session
Sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
Create a new recording session with auto-detected metadata.
Automatically detects:
- Shell type and version from SHELL env var
- OS from
/etc/os-releaseor uname - Hostname from
/etc/hostnameor environment - Environment variables: PATH, SHELL, HOME, USER, PWD
§Panics
Panics if the system clock is before the Unix epoch.
Sourcepub fn add_command(&mut self, cmd: Command)
pub fn add_command(&mut self, cmd: Command)
Add a command to the session.
Sourcepub fn complete(&mut self, status: SessionStatus)
pub fn complete(&mut self, status: SessionStatus)
Mark the session as complete with the given status.
Creates the footer with the current timestamp and command count.
§Panics
Panics if the system clock is before the Unix epoch.
Sourcepub fn is_recording(&self) -> bool
pub fn is_recording(&self) -> bool
Check if the session is still recording.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin 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
Mutably borrows from an owned value. Read more