From fa956cc1598f69c81d6db54b4e2e8f5f35cd9b23 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Wed, 30 Nov 2022 02:01:47 -0600 Subject: fix: fix config serialization and reorganize project --- src/search.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/search.rs') 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, - curr: Option, + iter: IntoIter, + curr: Option, } impl std::fmt::Debug for Search { @@ -32,9 +32,15 @@ impl Search { } } +impl From for Search { + fn from(config: Config) -> Self { + config.paths.into() + } +} + impl From for Search where - T: IntoIterator>, + T: IntoIterator>, { fn from(value: T) -> Self { Self { @@ -44,12 +50,6 @@ where } } -impl From 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() -- cgit v1.2.3-70-g09d2