pub struct Session { /* private fields */ }Expand description
Manages a session’s lifecycle: writing entries to the JSONL file.
Use SessionStore to create or load sessions. The Session type
handles the actual message appending, metadata updates, and auto-save.
Implementations§
Source§impl Session
impl Session
Sourcepub fn append_message(&mut self, message: &Message)
pub fn append_message(&mut self, message: &Message)
Append a message to the session file and update metadata.
Sourcepub fn set_token_usage(&mut self, usage: TokenUsage)
pub fn set_token_usage(&mut self, usage: TokenUsage)
Set the last known token usage reported by the provider. This is stored in the session metadata so it survives restarts.
pub fn id(&self) -> &str
pub fn meta(&self) -> &SessionMeta
Trait Implementations§
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
Mutably borrows from an owned value. Read more