summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/finder.rs4
-rw-r--r--src/logging.rs5
-rw-r--r--src/logging/config.rs4
-rw-r--r--src/paths.rs7
-rw-r--r--src/paths/config.rs61
-rw-r--r--src/paths/path_entry.rs59
6 files changed, 74 insertions, 66 deletions
diff --git a/src/finder.rs b/src/finder.rs
index ad7e303..3c74417 100644
--- a/src/finder.rs
+++ b/src/finder.rs
@@ -7,8 +7,8 @@ use std::{
process::{Child, Command, Output, Stdio},
};
-pub use config::Config;
-pub use error::{Error, Result};
+pub(crate) use config::Config;
+pub(crate) use error::{Error, Result};
mod config;
mod error;
diff --git a/src/logging.rs b/src/logging.rs
index 15008be..ee48518 100644
--- a/src/logging.rs
+++ b/src/logging.rs
@@ -3,8 +3,9 @@ use std::{fs::File, ops::Deref, sync::Arc};
use tracing::metadata::LevelFilter;
use tracing_subscriber::{prelude::*, Layer};
-pub use config::Config;
-pub use error::{Error, Result};
+pub(crate) use config::Config;
+pub(crate) use error::{Error, Result};
+
pub use level::Level;
mod config;
diff --git a/src/logging/config.rs b/src/logging/config.rs
index 1663f13..d9f14a6 100644
--- a/src/logging/config.rs
+++ b/src/logging/config.rs
@@ -1,8 +1,10 @@
-use super::level::{self, Level};
+use super::level;
use figment::{providers::Serialized, value, Figment, Metadata, Profile, Provider};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
+pub(crate) use level::Level;
+
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default)]
pub struct Config {
diff --git a/src/paths.rs b/src/paths.rs
index 9b9963a..b53eb93 100644
--- a/src/paths.rs
+++ b/src/paths.rs
@@ -3,11 +3,14 @@ use ignore::{Walk, WalkBuilder};
use std::{path::PathBuf, vec::IntoIter};
use tracing::warn;
-pub use config::{Config, PathEntry};
-pub use error::{Error, Result};
+pub(crate) use config::Config;
+pub(crate) use error::{Error, Result};
+
+pub use path_entry::PathEntry;
mod config;
mod error;
+mod path_entry;
pub struct Paths {
paths_iter: IntoIter<PathEntry>,
diff --git a/src/paths/config.rs b/src/paths/config.rs
index e5af2dc..1e9bc65 100644
--- a/src/paths/config.rs
+++ b/src/paths/config.rs
@@ -1,6 +1,6 @@
+use super::PathEntry;
use figment::{providers::Serialized, value, Figment, Metadata, Profile, Provider};
-use serde::{Deserialize, Deserializer, Serialize};
-use std::{convert::Infallible, path::PathBuf, str::FromStr};
+use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
pub struct Config {
@@ -29,63 +29,6 @@ impl Provider for Config {
}
}
-#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize)]
-pub struct PathEntry {
- pub path: PathBuf,
- pub hidden: bool,
- pub recurse: Option<usize>,
-}
-
-impl From<PathBuf> for PathEntry {
- fn from(path: PathBuf) -> Self {
- Self {
- path,
- ..Default::default()
- }
- }
-}
-
-impl FromStr for PathEntry {
- type Err = Infallible;
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- s.parse().map(PathBuf::into)
- }
-}
-
-impl<'de> Deserialize<'de> for PathEntry {
- fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
- where
- D: Deserializer<'de>,
- {
- #[derive(Deserialize)]
- #[serde(untagged)]
- enum Variants {
- String(String),
- Struct {
- path: PathBuf,
- #[serde(default)]
- hidden: bool,
- #[serde(default)]
- recurse: Option<usize>,
- },
- }
-
- match Variants::deserialize(deserializer)? {
- Variants::String(s) => s.parse().map_err(serde::de::Error::custom),
- Variants::Struct {
- path,
- hidden,
- recurse,
- } => Ok(Self {
- path,
- hidden,
- recurse,
- }),
- }
- }
-}
-
#[cfg(test)]
mod tests {
use super::*;
diff --git a/src/paths/path_entry.rs b/src/paths/path_entry.rs
new file mode 100644
index 0000000..b050009
--- /dev/null
+++ b/src/paths/path_entry.rs
@@ -0,0 +1,59 @@
+use serde::{Deserialize, Deserializer, Serialize};
+use std::{convert::Infallible, path::PathBuf, str::FromStr};
+
+#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize)]
+pub struct PathEntry {
+ pub path: PathBuf,
+ pub hidden: bool,
+ pub recurse: Option<usize>,
+}
+
+impl From<PathBuf> for PathEntry {
+ fn from(path: PathBuf) -> Self {
+ Self {
+ path,
+ ..Default::default()
+ }
+ }
+}
+
+impl FromStr for PathEntry {
+ type Err = Infallible;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ s.parse().map(PathBuf::into)
+ }
+}
+
+impl<'de> Deserialize<'de> for PathEntry {
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: Deserializer<'de>,
+ {
+ #[derive(Deserialize)]
+ #[serde(untagged)]
+ enum Variants {
+ String(String),
+ Struct {
+ path: PathBuf,
+ #[serde(default)]
+ hidden: bool,
+ #[serde(default)]
+ recurse: Option<usize>,
+ },
+ }
+
+ match Variants::deserialize(deserializer)? {
+ Variants::String(s) => s.parse().map_err(serde::de::Error::custom),
+ Variants::Struct {
+ path,
+ hidden,
+ recurse,
+ } => Ok(Self {
+ path,
+ hidden,
+ recurse,
+ }),
+ }
+ }
+}