pub struct HistoryManager { /* private fields */ }Expand description
Manages conversation history for a session
Implementations§
Source§impl HistoryManager
impl HistoryManager
Sourcepub fn with_max_size(max_size: usize) -> Self
pub fn with_max_size(max_size: usize) -> Self
Create a new history manager with a maximum size limit
Sourcepub fn add_message(&mut self, message: Message)
pub fn add_message(&mut self, message: Message)
Add a message to history
Messages are automatically ordered by timestamp. If the history exceeds the maximum size, the oldest message is removed.
Sourcepub fn get_recent_messages(&self, count: usize) -> Vec<Message>
pub fn get_recent_messages(&self, count: usize) -> Vec<Message>
Get the most recent N messages
Returns messages in chronological order (oldest first).
Sourcepub fn search_by_content(&self, query: &str) -> Vec<Message>
pub fn search_by_content(&self, query: &str) -> Vec<Message>
Search history by content
Returns all messages whose content contains the query string (case-insensitive). Results are returned in chronological order.
Sourcepub fn get_all_messages(&self) -> Vec<Message>
pub fn get_all_messages(&self) -> Vec<Message>
Get all messages in the history
Returns messages in chronological order (oldest first).
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get the number of messages in the history
Trait Implementations§
Source§impl Clone for HistoryManager
impl Clone for HistoryManager
Source§fn clone(&self) -> HistoryManager
fn clone(&self) -> HistoryManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HistoryManager
impl Debug for HistoryManager
Auto Trait Implementations§
impl Freeze for HistoryManager
impl RefUnwindSafe for HistoryManager
impl Send for HistoryManager
impl Sync for HistoryManager
impl Unpin for HistoryManager
impl UnwindSafe for HistoryManager
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