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/installer/project_installer.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/installer/project_installer.rs')
| -rw-r--r-- | crates/shirabe/src/installer/project_installer.rs | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/crates/shirabe/src/installer/project_installer.rs b/crates/shirabe/src/installer/project_installer.rs index ad2c3a6..1c50a16 100644 --- a/crates/shirabe/src/installer/project_installer.rs +++ b/crates/shirabe/src/installer/project_installer.rs @@ -5,8 +5,7 @@ use crate::installer::InstallerInterface; use crate::package::PackageInterface; use crate::repository::InstalledRepositoryInterface; use crate::util::Filesystem; -use shirabe_external_packages::react::promise::PromiseInterface; -use shirabe_php_shim::InvalidArgumentException; +use shirabe_php_shim::{InvalidArgumentException, PhpMixed}; #[derive(Debug)] pub struct ProjectInstaller { @@ -43,11 +42,11 @@ impl InstallerInterface for ProjectInstaller { false } - fn download( + async fn download( &self, package: &dyn PackageInterface, prev_package: Option<&dyn PackageInterface>, - ) -> anyhow::Result<Option<Box<dyn PromiseInterface>>> { + ) -> anyhow::Result<Option<PhpMixed>> { let install_path = &self.install_path; if std::path::Path::new(install_path).exists() && !self.filesystem.borrow().is_dir_empty(install_path) @@ -68,35 +67,35 @@ impl InstallerInterface for ProjectInstaller { .map(Some) } - fn prepare( + async fn prepare( &self, r#type: &str, package: &dyn PackageInterface, prev_package: Option<&dyn PackageInterface>, - ) -> anyhow::Result<Option<Box<dyn PromiseInterface>>> { + ) -> anyhow::Result<Option<PhpMixed>> { self.download_manager .borrow() .prepare(r#type, package, &self.install_path, prev_package) .map(Some) } - fn cleanup( + async fn cleanup( &self, r#type: &str, package: &dyn PackageInterface, prev_package: Option<&dyn PackageInterface>, - ) -> anyhow::Result<Option<Box<dyn PromiseInterface>>> { + ) -> anyhow::Result<Option<PhpMixed>> { self.download_manager .borrow() .cleanup(r#type, package, &self.install_path, prev_package) .map(Some) } - fn install( + async fn install( &mut self, _repo: &mut dyn InstalledRepositoryInterface, package: &dyn PackageInterface, - ) -> anyhow::Result<Option<Box<dyn PromiseInterface>>> { + ) -> anyhow::Result<Option<PhpMixed>> { Ok(Some( self.download_manager .borrow() @@ -104,12 +103,12 @@ impl InstallerInterface for ProjectInstaller { )) } - fn update( + async fn update( &mut self, _repo: &mut dyn InstalledRepositoryInterface, _initial: &dyn PackageInterface, _target: &dyn PackageInterface, - ) -> anyhow::Result<Option<Box<dyn PromiseInterface>>> { + ) -> anyhow::Result<Option<PhpMixed>> { Err(InvalidArgumentException { message: "not supported".to_string(), code: 0, @@ -117,11 +116,11 @@ impl InstallerInterface for ProjectInstaller { .into()) } - fn uninstall( + async fn uninstall( &mut self, _repo: &mut dyn InstalledRepositoryInterface, _package: &dyn PackageInterface, - ) -> anyhow::Result<Option<Box<dyn PromiseInterface>>> { + ) -> anyhow::Result<Option<PhpMixed>> { Err(InvalidArgumentException { message: "not supported".to_string(), code: 0, |
