summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-23 11:11:25 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-23 11:11:25 +0300
commit7ea9c6459d621a96fa496a2fe2ae4ecc941a33ce (patch)
treeb3992aa630d93f0713349dae93b764fd7f6a612b
parent86fc82d9296874de4836ee7c1ae4d6f0bb71eebc (diff)
downloadsummain-rs-7ea9c6459d621a96fa496a2fe2ae4ecc941a33ce.tar.gz
more async
-rw-r--r--src/bin/summain.rs12
-rw-r--r--src/lib.rs2
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()))
}
diff --git a/src/lib.rs b/src/lib.rs
index 3c90156..00c64cf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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)?)