Skip to main content

toml_to_session

Function toml_to_session 

Source
pub fn toml_to_session(toml_str: &str, original: &Session) -> Result<Session>
Expand description

Parse a TOML string back into a Session, merging with the original.

Preserves non-editable fields from the original session:

  • header.version, header.id, header.started_at, header.env
  • footer (ended_at, status)
  • command timestamps (started_at, ended_at) for existing indices

Updates from the editable content:

  • header.name, header.tags, header.shell, header.os, header.hostname
  • commands (text, cwd, exit_code, duration_ms)

ยงErrors

Returns an error if TOML parsing fails.