summaryrefslogtreecommitdiffstats
path: root/src/search.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-11-30 02:01:47 -0600
committerToby Vincent <tobyv13@gmail.com>2022-11-30 02:01:47 -0600
commitfa956cc1598f69c81d6db54b4e2e8f5f35cd9b23 (patch)
treeafb753d7dd999efb864af6dde3fb28633d86a41c /src/search.rs
parentb32d10b65ee7bdd939915f2a34929386ac4595ea (diff)
fix: fix config serialization and reorganize project
Diffstat (limited to 'src/search.rs')
-rw-r--r--src/search.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/search.rs b/src/search.rs
index b2db0e3..6249da4 100644
--- a/src/search.rs
+++ b/src/search.rs
@@ -1,14 +1,14 @@
use figment::Provider;
use std::vec::IntoIter;
-use self::entry::Entry;
-use crate::{project::ProjectItem, Config, Result};
+use self::entry::EntryIter;
+use crate::{config::Entry, project::ProjectItem, Config, Result};
pub mod entry;
pub struct Search {
- iter: IntoIter<entry::Config>,
- curr: Option<Entry>,
+ iter: IntoIter<Entry>,
+ curr: Option<EntryIter>,
}
impl std::fmt::Debug for Search {
@@ -32,9 +32,15 @@ impl Search {
}
}
+impl From<Config> for Search {
+ fn from(config: Config) -> Self {
+ config.paths.into()
+ }
+}
+
impl<T> From<T> for Search
where
- T: IntoIterator<IntoIter = IntoIter<entry::Config>>,
+ T: IntoIterator<IntoIter = IntoIter<Entry>>,
{
fn from(value: T) -> Self {
Self {
@@ -44,12 +50,6 @@ where
}
}
-impl From<Config> for Search {
- fn from(value: Config) -> Self {
- value.paths.into()
- }
-}
-
impl Iterator for Search {
type Item = ProjectItem;
@@ -86,17 +86,17 @@ mod tests {
let project4 = temp_dir.join("subdir/project4");
let paths = Search::from(Vec::from([
- entry::Config {
+ Entry {
path_buf: project_dir.to_owned(),
max_depth: Some(1),
..Default::default()
},
- entry::Config {
+ Entry {
path_buf: project3.to_owned(),
max_depth: Some(0),
..Default::default()
},
- entry::Config {
+ Entry {
path_buf: project4.to_owned(),
max_depth: Some(0),
..Default::default()