From 5adc4e467f01865ba2d4f519334ee1b0496b8ebf Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 22 May 2026 23:14:27 +0900 Subject: refactor(promise): change functions returning PromiseInterface to async fn --- crates/shirabe/src/util/http_downloader.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'crates/shirabe/src/util/http_downloader.rs') diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index 3072df2..6f769ce 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -5,8 +5,6 @@ use indexmap::IndexMap; use crate::util::Silencer; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; -use shirabe_external_packages::react::promise::Promise; -use shirabe_external_packages::react::promise::PromiseInterface; use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, array_replace_recursive, chr, extension_loaded, file_get_contents, function_exists, implode, is_numeric, max, min, @@ -203,11 +201,11 @@ impl HttpDownloader { } /// Create an async download operation - pub fn add( + pub async fn add( &mut self, url: &str, options: IndexMap, - ) -> Result> { + ) -> Result { if "" == url { return Err(InvalidArgumentException { message: "$url must not be an empty string".to_string(), @@ -255,12 +253,12 @@ impl HttpDownloader { } /// Create an async copy operation - pub fn add_copy( + pub async fn add_copy( &mut self, url: &str, to: &str, options: IndexMap, - ) -> Result> { + ) -> Result { if "" == url { return Err(InvalidArgumentException { message: "$url must not be an empty string".to_string(), @@ -292,11 +290,7 @@ impl HttpDownloader { /// @phpstan-param Request $request /// @return array{Job, PromiseInterface} - fn add_job( - &mut self, - mut request: Request, - sync: bool, - ) -> Result<(JobHandle, Box)> { + async fn add_job(&mut self, mut request: Request, sync: bool) -> Result<(JobHandle, Response)> { request.options = array_replace_recursive(self.options.clone(), request.options); let id = self.id_gen; -- cgit v1.3.1