diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-23 11:11:25 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-23 11:11:25 +0300 |
commit | 7ea9c6459d621a96fa496a2fe2ae4ecc941a33ce (patch) | |
tree | b3992aa630d93f0713349dae93b764fd7f6a612b | |
parent | 86fc82d9296874de4836ee7c1ae4d6f0bb71eebc (diff) | |
download | summain-rs-7ea9c6459d621a96fa496a2fe2ae4ecc941a33ce.tar.gz |
more async
-rw-r--r-- | src/bin/summain.rs | 12 | ||||
-rw-r--r-- | src/lib.rs | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/bin/summain.rs b/src/bin/summain.rs index b0be829..751a104 100644 --- a/src/bin/summain.rs +++ b/src/bin/summain.rs @@ -22,7 +22,7 @@ async fn async_main() -> anyhow::Result<()> { } for h in handles { - h.await??; + h.await?.await?; } Ok(()) @@ -34,12 +34,14 @@ struct Opt { pathnames: Vec<PathBuf>, } -fn report(path: PathBuf) -> anyhow::Result<()> { - let m = manifest(&path)?; +async fn report(path: PathBuf) -> anyhow::Result<()> { + let m = manifest(&path).await?; print!("{}", serde_yaml::to_string(&m)?); Ok(()) } -fn manifest(path: &Path) -> anyhow::Result<ManifestEntry> { - ManifestEntry::new(path).with_context(|| format!("{}", path.display())) +async fn manifest(path: &Path) -> anyhow::Result<ManifestEntry> { + ManifestEntry::new(path) + .await + .with_context(|| format!("{}", path.display())) } @@ -60,7 +60,7 @@ impl ManifestEntry { /// caller. This function doesn't query the system for it. /// /// The structure can be serialized using serde. - pub fn new(path: &Path) -> std::io::Result<Self> { + pub async fn new(path: &Path) -> std::io::Result<Self> { let m = symlink_metadata(path)?; let hash = if m.is_file() { Some(file_checksum(path)?) |