From e068a9d644fde6659a88accd55b3f1d0d9d7cf46 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 23 May 2026 03:07:15 +0900 Subject: refactor(promise): rewrite promise bodies to async/await Mechanically convert promise-returning function bodies to async/await: resolve() returns the value directly, forwarding calls get .await, and simple .then chains become await sequences. Also collapse the installer double-Option (Result>> -> Result>). Hard spots that depend on the Loop::wait / job-machine boundary (accept/reject orchestration, closures capturing &mut self, batch waits) are left intact and marked with TODO(phase-c-promise) for manual porting. The crate does not compile yet; traits still need #[async_trait]. Co-Authored-By: Claude Opus 4.7 --- crates/shirabe/src/downloader/archive_downloader.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/shirabe/src/downloader/archive_downloader.rs') diff --git a/crates/shirabe/src/downloader/archive_downloader.rs b/crates/shirabe/src/downloader/archive_downloader.rs index 4842b05..ac898d5 100644 --- a/crates/shirabe/src/downloader/archive_downloader.rs +++ b/crates/shirabe/src/downloader/archive_downloader.rs @@ -36,6 +36,7 @@ pub trait ArchiveDownloader { self.cleanup_executed_mut().remove(package.get_name()); self.inner_mut() .prepare(r#type, package, path, prev_package) + .await } async fn cleanup( @@ -49,6 +50,7 @@ pub trait ArchiveDownloader { .insert(package.get_name().to_string(), true); self.inner_mut() .cleanup(r#type, package, path, prev_package) + .await } /// @inheritDoc @@ -122,6 +124,7 @@ pub trait ArchiveDownloader { let _ = file_name; + // TODO(phase-c-promise): rewrite extract().then(onFulfilled/onRejected) + renameRecursively chain as an await sequence let promise = self.extract(package, "", &temporary_dir)?; // TODO(phase-b): the original PHP chains React promise `.then(onFulfilled, onRejected)` -- cgit v1.3.1