version bump; improve DupeMap render on -V

master
Avril 4 years ago
parent 214d259a06
commit 552035e5f1
Signed by: flanchan
GPG Key ID: 284488987C31F630

2
Cargo.lock generated

@ -555,7 +555,7 @@ dependencies = [
[[package]] [[package]]
name = "rmdupe" name = "rmdupe"
version = "1.0.0" version = "1.1.1"
dependencies = [ dependencies = [
"chrono", "chrono",
"futures", "futures",

@ -1,6 +1,6 @@
[package] [package]
name = "rmdupe" name = "rmdupe"
version = "1.0.0" version = "1.1.1"
authors = ["Avril <flanchan@cumallover.me>"] authors = ["Avril <flanchan@cumallover.me>"]
edition = "2018" edition = "2018"

@ -10,6 +10,7 @@ use std::{
Path, Path,
PathBuf PathBuf
}, },
fmt,
}; };
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug)]
@ -19,6 +20,17 @@ pub struct DupeMap
table: HashMap<PathBuf, (hash::Sha256Hash, bool)>, // What we save and load, and if it's transient (ignored in calculate) table: HashMap<PathBuf, (hash::Sha256Hash, bool)>, // 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 /// Do we care about windows? nah
#[inline] #[inline]
fn path_bytes(path: &Path) -> &[u8] fn path_bytes(path: &Path) -> &[u8]

@ -126,7 +126,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>>
} }
} }
log!(Debug, lmode => "Loaded hashes: {:?}", hashes); log!(Debug, lmode => "Loaded hashes: {}", hashes);
log!(Info, lmode => "Starting checks (threaded)"); log!(Info, lmode => "Starting checks (threaded)");
let hashes = Arc::new(Mutex::new(hashes)); let hashes = Arc::new(Mutex::new(hashes));
for path in args.paths.iter() for path in args.paths.iter()
@ -154,7 +154,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>>
log!(Info, lmode => "Found: {:?}", done); log!(Info, lmode => "Found: {:?}", done);
let hashes = hashes.lock().await; let hashes = hashes.lock().await;
log!(Debug, lmode => "New hashes: {:?}", hashes); log!(Debug, lmode => "New hashes: {}", hashes);
for save in args.save.iter() for save in args.save.iter()
{ {
@ -226,7 +226,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>>
} }
log!(Info, lmode => "Found: {:?}", done); log!(Info, lmode => "Found: {:?}", done);
log!(Debug, lmode => "New hashes: {:?}", hashes); log!(Debug, lmode => "New hashes: {}", hashes);
for save in args.save.iter() for save in args.save.iter()
{ {

Loading…
Cancel
Save