diff options
| author | Vladislav Stepanov <8uk.8ak@gmail.com> | 2023-04-14 23:18:58 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-14 20:18:58 +0100 |
| commit | c05d2850420a2c163b8f62c33a6cef7c0ae1ad8d (patch) | |
| tree | 2c44a44eda7e76fa74e78ac1fd02f55c1ed4d804 /src/command/client/search/engines.rs | |
| parent | Switch to uuidv7 (#864) (diff) | |
| download | atuin-c05d2850420a2c163b8f62c33a6cef7c0ae1ad8d.zip | |
Workspace reorder (#868)
* Try different workspace structure
Move main crate (atuin) to be on the same level with other crates in
this workspace
* extract common dependencies to the workspace definition
* fix base64 v0.21 deprecation warning
* questionable: update deps & fix chrono deprecations
possible panic sites are unchanged, they're just more visible now
* Revert "questionable: update deps & fix chrono deprecations"
This reverts commit 993e60f8dea81a1625a04285a617959ad09a0866.
Diffstat (limited to 'src/command/client/search/engines.rs')
| -rw-r--r-- | src/command/client/search/engines.rs | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/command/client/search/engines.rs b/src/command/client/search/engines.rs deleted file mode 100644 index 878b1431..00000000 --- a/src/command/client/search/engines.rs +++ /dev/null @@ -1,46 +0,0 @@ -use async_trait::async_trait; -use atuin_client::{ - database::{Context, Database}, - history::History, - settings::{FilterMode, SearchMode}, -}; -use eyre::Result; - -use super::cursor::Cursor; - -pub mod db; -pub mod skim; - -pub fn engine(search_mode: SearchMode) -> Box<dyn SearchEngine> { - match search_mode { - SearchMode::Skim => Box::new(skim::Search::new()) as Box<_>, - mode => Box::new(db::Search(mode)) as Box<_>, - } -} - -pub struct SearchState { - pub input: Cursor, - pub filter_mode: FilterMode, - pub context: Context, -} - -#[async_trait] -pub trait SearchEngine: Send + Sync + 'static { - async fn full_query( - &mut self, - state: &SearchState, - db: &mut dyn Database, - ) -> Result<Vec<History>>; - - async fn query(&mut self, state: &SearchState, db: &mut dyn Database) -> Result<Vec<History>> { - if state.input.as_str().is_empty() { - Ok(db - .list(state.filter_mode, &state.context, Some(200), true) - .await? - .into_iter() - .collect::<Vec<_>>()) - } else { - self.full_query(state, db).await - } - } -} |
