pub struct ConversationReader;Implementations§
Source§impl ConversationReader
impl ConversationReader
pub fn read_conversation<P: AsRef<Path>>(path: P) -> Result<Conversation>
pub fn read_conversation_metadata<P: AsRef<Path>>( path: P, ) -> Result<ConversationMetadata>
pub fn read_history<P: AsRef<Path>>(path: P) -> Result<Vec<HistoryEntry>>
Sourcepub fn read_from_offset<P: AsRef<Path>>(
path: P,
byte_offset: u64,
) -> Result<(Vec<ConversationEntry>, u64)>
pub fn read_from_offset<P: AsRef<Path>>( path: P, byte_offset: u64, ) -> Result<(Vec<ConversationEntry>, u64)>
Read conversation entries starting from a byte offset. Returns the new entries and the new byte offset (end of file position).
This is used for incremental reading - call with offset=0 initially, then use the returned offset for subsequent calls to only read new entries.
Sourcepub fn read_first_session_id<P: AsRef<Path>>(path: P) -> Option<String>
pub fn read_first_session_id<P: AsRef<Path>>(path: P) -> Option<String>
Read the first session_id found in a conversation file.
Scans at most 10 lines, returning the first non-empty session_id
field from a parseable ConversationEntry. Returns None if the
file doesn’t exist, can’t be read, or has no session_id in the
first 10 lines.
Auto Trait Implementations§
impl Freeze for ConversationReader
impl RefUnwindSafe for ConversationReader
impl Send for ConversationReader
impl Sync for ConversationReader
impl Unpin for ConversationReader
impl UnsafeUnpin for ConversationReader
impl UnwindSafe for ConversationReader
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