pub struct HistoryEngine { /* private fields */ }Implementations§
Source§impl HistoryEngine
impl HistoryEngine
pub fn new() -> Result<Self>
pub fn in_memory() -> Result<Self>
Sourcepub fn add(&self, command: &str, cwd: Option<&str>) -> Result<i64>
pub fn add(&self, command: &str, cwd: Option<&str>) -> Result<i64>
Add a command to history, updating frequency if it already exists
Sourcepub fn update_last(
&self,
id: i64,
duration_ms: i64,
exit_code: i32,
) -> Result<()>
pub fn update_last( &self, id: i64, duration_ms: i64, exit_code: i32, ) -> Result<()>
Update the duration and exit code of the last command
Sourcepub fn search(&self, query: &str, limit: usize) -> Result<Vec<HistoryEntry>>
pub fn search(&self, query: &str, limit: usize) -> Result<Vec<HistoryEntry>>
Search history with FTS5 (fuzzy/substring matching)
Sourcepub fn search_prefix(
&self,
prefix: &str,
limit: usize,
) -> Result<Vec<HistoryEntry>>
pub fn search_prefix( &self, prefix: &str, limit: usize, ) -> Result<Vec<HistoryEntry>>
Search history with prefix matching (for up-arrow completion)
Sourcepub fn for_directory(
&self,
cwd: &str,
limit: usize,
) -> Result<Vec<HistoryEntry>>
pub fn for_directory( &self, cwd: &str, limit: usize, ) -> Result<Vec<HistoryEntry>>
Get history for a specific directory
Sourcepub fn get_by_offset(&self, offset: usize) -> Result<Option<HistoryEntry>>
pub fn get_by_offset(&self, offset: usize) -> Result<Option<HistoryEntry>>
Get entry by index from end (0 = most recent, like !-1)
Sourcepub fn get_by_number(&self, num: i64) -> Result<Option<HistoryEntry>>
pub fn get_by_number(&self, num: i64) -> Result<Option<HistoryEntry>>
Get entry by absolute history number (like !123)
Auto Trait Implementations§
impl !Freeze for HistoryEngine
impl !RefUnwindSafe for HistoryEngine
impl Send for HistoryEngine
impl !Sync for HistoryEngine
impl Unpin for HistoryEngine
impl UnsafeUnpin for HistoryEngine
impl !UnwindSafe for HistoryEngine
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> 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