diff --git a/Cargo.lock b/Cargo.lock index 3165d72..3a42663 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -555,7 +555,7 @@ dependencies = [ [[package]] name = "rmdupe" -version = "1.0.0" +version = "1.1.1" dependencies = [ "chrono", "futures", diff --git a/Cargo.toml b/Cargo.toml index f6d193c..91e0bb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rmdupe" -version = "1.0.0" +version = "1.1.1" authors = ["Avril "] edition = "2018" diff --git a/src/container.rs b/src/container.rs index e81e600..45f78b7 100644 --- a/src/container.rs +++ b/src/container.rs @@ -10,6 +10,7 @@ use std::{ Path, PathBuf }, + fmt, }; #[derive(Clone, PartialEq, Eq, Debug)] @@ -19,6 +20,17 @@ pub struct DupeMap table: HashMap, // What we save and load, and if it's transient (ignored in calculate) } +impl fmt::Display for DupeMap +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result + { + write!(f, "[DupeMap: Iteration: {} unique hashes computed. ", self.iteration.len())?; + let len = self.table.len(); + let tlen = self.table.iter().filter(|(_, (_, x))| *x).count(); + write!(f, "Table: {} cached ({} trans. {} real.]", len, tlen, len-tlen) + } +} + /// Do we care about windows? nah #[inline] fn path_bytes(path: &Path) -> &[u8] diff --git a/src/main.rs b/src/main.rs index fe5cecb..f5ecfc4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -126,7 +126,7 @@ async fn main() -> Result<(), Box> } } - log!(Debug, lmode => "Loaded hashes: {:?}", hashes); + log!(Debug, lmode => "Loaded hashes: {}", hashes); log!(Info, lmode => "Starting checks (threaded)"); let hashes = Arc::new(Mutex::new(hashes)); for path in args.paths.iter() @@ -154,7 +154,7 @@ async fn main() -> Result<(), Box> log!(Info, lmode => "Found: {:?}", done); let hashes = hashes.lock().await; - log!(Debug, lmode => "New hashes: {:?}", hashes); + log!(Debug, lmode => "New hashes: {}", hashes); for save in args.save.iter() { @@ -226,7 +226,7 @@ fn main() -> Result<(), Box> } log!(Info, lmode => "Found: {:?}", done); - log!(Debug, lmode => "New hashes: {:?}", hashes); + log!(Debug, lmode => "New hashes: {}", hashes); for save in args.save.iter() {