pub struct CommandHistory { /* private fields */ }
Implementations§
Source§impl CommandHistory
impl CommandHistory
pub fn new() -> Result<Self>
pub fn add_entry( &mut self, command: String, success: bool, duration_ms: Option<u64>, ) -> Result<()>
pub fn add_entry_with_schema( &mut self, command: String, success: bool, duration_ms: Option<u64>, schema_columns: Vec<String>, data_source: Option<String>, ) -> Result<()>
pub fn search(&self, query: &str) -> Vec<HistoryMatch>
pub fn search_with_schema( &self, query: &str, current_columns: &[String], current_source: Option<&str>, ) -> Vec<HistoryMatch>
pub fn get_recent(&self, limit: usize) -> Vec<&HistoryEntry>
pub fn get_all(&self) -> &[HistoryEntry]
pub fn get_last_entry(&self) -> Option<&HistoryEntry>
Sourcepub fn get_session_entries(&self) -> &[HistoryEntry]
pub fn get_session_entries(&self) -> &[HistoryEntry]
Get session-only entries (from current run)
Get entries for navigation (session + starred from persistent)
Sourcepub fn toggle_star(&mut self, command: &str) -> Result<()>
pub fn toggle_star(&mut self, command: &str) -> Result<()>
Star/unstar a command
pub fn clear(&mut self) -> Result<()>
Sourcepub fn clean_and_save(&mut self) -> Result<()>
pub fn clean_and_save(&mut self) -> Result<()>
Clean the history file by removing duplicates and rewriting it This is called after loading to ensure the file stays clean
pub fn stats(&self) -> HistoryStats
Trait Implementations§
Source§impl Clone for CommandHistory
impl Clone for CommandHistory
Auto Trait Implementations§
impl !Freeze for CommandHistory
impl RefUnwindSafe for CommandHistory
impl Send for CommandHistory
impl Sync for CommandHistory
impl Unpin for CommandHistory
impl UnwindSafe for CommandHistory
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more