diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-22 23:14:27 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-23 15:48:00 +0900 |
| commit | 5adc4e467f01865ba2d4f519334ee1b0496b8ebf (patch) | |
| tree | f6970f181793c0f8b9b67b2af54c09ae13a25c4b /crates/shirabe/src/downloader/file_downloader.rs | |
| parent | 2a1696906344cb4da768a940bf8b1f89bbc82b47 (diff) | |
| download | php-shirabe-5adc4e467f01865ba2d4f519334ee1b0496b8ebf.tar.gz php-shirabe-5adc4e467f01865ba2d4f519334ee1b0496b8ebf.tar.zst php-shirabe-5adc4e467f01865ba2d4f519334ee1b0496b8ebf.zip | |
refactor(promise): change functions returning PromiseInterface to async fn
Diffstat (limited to 'crates/shirabe/src/downloader/file_downloader.rs')
| -rw-r--r-- | crates/shirabe/src/downloader/file_downloader.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs index ce5d275..0920342 100644 --- a/crates/shirabe/src/downloader/file_downloader.rs +++ b/crates/shirabe/src/downloader/file_downloader.rs @@ -6,7 +6,6 @@ use indexmap::IndexMap; use std::sync::{LazyLock, Mutex}; use crate::util::Silencer; -use shirabe_external_packages::react::promise::PromiseInterface; use shirabe_external_packages::react::promise::resolve as react_promise_resolve; use shirabe_php_shim::{ DIRECTORY_SEPARATOR, InvalidArgumentException, PATHINFO_BASENAME, PATHINFO_EXTENSION, @@ -148,13 +147,13 @@ impl DownloaderInterface for FileDownloader { } /// @inheritDoc - fn download( + async fn download( &self, package: &dyn PackageInterface, path: &str, _prev_package: Option<&dyn PackageInterface>, output: bool, - ) -> Result<Box<dyn PromiseInterface>> { + ) -> Result<Option<PhpMixed>> { if package.get_dist_url().is_none() { return Err(InvalidArgumentException { message: "The given package is missing url information".to_string(), @@ -212,24 +211,24 @@ impl DownloaderInterface for FileDownloader { } /// @inheritDoc - fn prepare( + async fn prepare( &self, _type: &str, _package: &dyn PackageInterface, _path: &str, _prev_package: Option<&dyn PackageInterface>, - ) -> Result<Box<dyn PromiseInterface>> { + ) -> Result<Option<PhpMixed>> { Ok(react_promise_resolve(Some(PhpMixed::Null))) } /// @inheritDoc - fn cleanup( + async fn cleanup( &self, _type: &str, package: &dyn PackageInterface, path: &str, _prev_package: Option<&dyn PackageInterface>, - ) -> Result<Box<dyn PromiseInterface>> { + ) -> Result<Option<PhpMixed>> { let file_name = self.get_file_name(package, path); if file_exists(&file_name) { self.filesystem.borrow_mut().unlink(&file_name)?; @@ -278,12 +277,12 @@ impl DownloaderInterface for FileDownloader { } /// @inheritDoc - fn install( + async fn install( &self, package: &dyn PackageInterface, path: &str, output: bool, - ) -> Result<Box<dyn PromiseInterface>> { + ) -> Result<Option<PhpMixed>> { if output { self.io .write_error(&format!(" - {}", InstallOperation::format(package, false))); @@ -338,12 +337,12 @@ impl DownloaderInterface for FileDownloader { } /// @inheritDoc - fn update( + async fn update( &self, initial: &dyn PackageInterface, target: &dyn PackageInterface, path: &str, - ) -> Result<Box<dyn PromiseInterface>> { + ) -> Result<Option<PhpMixed>> { self.io.write_error(&format!( " - {}{}", UpdateOperation::format(initial, target, false), @@ -357,12 +356,12 @@ impl DownloaderInterface for FileDownloader { } /// @inheritDoc - fn remove( + async fn remove( &self, package: &dyn PackageInterface, path: &str, output: bool, - ) -> Result<Box<dyn PromiseInterface>> { + ) -> Result<Option<PhpMixed>> { if output { self.io.write_error(&format!( " - {}", |
