Struct reedline::SqliteBackedHistory
source · pub struct SqliteBackedHistory { /* private fields */ }
Expand description
A history that stores the values to an SQLite database. In addition to storing the command, the history can store an additional arbitrary HistoryEntryContext, to add information such as a timestamp, running directory, result…
§Required feature:
sqlite
or sqlite-dynlib
Implementations§
Trait Implementations§
source§impl History for SqliteBackedHistory
impl History for SqliteBackedHistory
source§fn save(&mut self, entry: HistoryItem) -> Result<HistoryItem>
fn save(&mut self, entry: HistoryItem) -> Result<HistoryItem>
save a history item to the database
if given id is None, a new id is created and set in the return value
if given id is Some, the existing entry is updated
source§fn load(&self, id: HistoryItemId) -> Result<HistoryItem>
fn load(&self, id: HistoryItemId) -> Result<HistoryItem>
load a history item by its id
source§fn count(&self, query: SearchQuery) -> Result<i64>
fn count(&self, query: SearchQuery) -> Result<i64>
retrieves the next unused session id
count the results of a query
source§fn search(&self, query: SearchQuery) -> Result<Vec<HistoryItem>>
fn search(&self, query: SearchQuery) -> Result<Vec<HistoryItem>>
return the results of a query
source§fn update(
&mut self,
id: HistoryItemId,
updater: &dyn Fn(HistoryItem) -> HistoryItem
) -> Result<()>
fn update( &mut self, id: HistoryItemId, updater: &dyn Fn(HistoryItem) -> HistoryItem ) -> Result<()>
update an item atomically
source§fn session(&self) -> Option<HistorySessionId>
fn session(&self) -> Option<HistorySessionId>
get the history session id
Auto Trait Implementations§
impl !Freeze for SqliteBackedHistory
impl !RefUnwindSafe for SqliteBackedHistory
impl Send for SqliteBackedHistory
impl !Sync for SqliteBackedHistory
impl Unpin for SqliteBackedHistory
impl !UnwindSafe for SqliteBackedHistory
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