pub struct SessionWriter { /* private fields */ }Expand description
Append-only JSONL writer with crash-safe flush.
Implementations§
Source§impl SessionWriter
impl SessionWriter
Sourcepub fn create(path: &Path, header: SessionHeader) -> Result<Self>
pub fn create(path: &Path, header: SessionHeader) -> Result<Self>
Create a new session file with the given header.
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open an existing session file for appending (seeks to end).
If the file’s last line is incomplete (no trailing newline from a crashed write), the incomplete tail is truncated so subsequent appends land on a clean line boundary.
Sourcepub fn append(&mut self, entry: &SessionEntry) -> Result<()>
pub fn append(&mut self, entry: &SessionEntry) -> Result<()>
Append a session entry as a new JSONL line.
Auto Trait Implementations§
impl Freeze for SessionWriter
impl RefUnwindSafe for SessionWriter
impl Send for SessionWriter
impl Sync for SessionWriter
impl Unpin for SessionWriter
impl UnsafeUnpin for SessionWriter
impl UnwindSafe for SessionWriter
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