1use std::path::PathBuf;
2
3use crate::discovery::bfs::bfs_discover;
4use crate::discovery::cache::FsCache;
5use crate::paths;
6
7mod bfs;
8mod cache;
9
10pub mod matcher;
11
12#[derive(Debug, Clone)]
13pub struct DiscoveryCandidate {
14 pub path: PathBuf,
15 pub score: f32,
16}
17
18impl Default for DiscoveryCandidate {
19 fn default() -> Self {
20 Self {
21 path: PathBuf::new(),
22 score: 0.0,
23 }
24 }
25}
26
27#[derive(Debug, PartialEq)]
28pub enum Matchkind {
29 Exact,
30 Prefix,
31 Substring,
32 Fuzzy,
33}
34
35pub fn discover(tokens: &[&str], max_depth: usize, max_results: usize) -> Vec<DiscoveryCandidate> {
36 let roots = paths::search_roots();
37 let mut cache = FsCache::new();
38
39 bfs_discover(&roots, tokens, max_depth, max_results, &mut cache)
40}