diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-19 21:46:01 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-19 21:46:08 +0900 |
| commit | 5e31fa33c3b5cf726a57a063b8e7a070869250fe (patch) | |
| tree | 98522466966fa7df483cad174ab5fc03db39bc09 /crates/shirabe/src/util/loop.rs | |
| parent | c839244d8d09f3036ebfee8eef7eb6b147e593ab (diff) | |
| download | php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.gz php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.zst php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.zip | |
fix(compile): fix more random compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/loop.rs')
| -rw-r--r-- | crates/shirabe/src/util/loop.rs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/crates/shirabe/src/util/loop.rs b/crates/shirabe/src/util/loop.rs index 189b8a3..9ffee8f 100644 --- a/crates/shirabe/src/util/loop.rs +++ b/crates/shirabe/src/util/loop.rs @@ -10,21 +10,21 @@ use shirabe_php_shim::microtime; #[derive(Debug)] pub struct Loop { - http_downloader: HttpDownloader, - process_executor: Option<ProcessExecutor>, + http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>, + process_executor: Option<std::rc::Rc<std::cell::RefCell<ProcessExecutor>>>, current_promises: IndexMap<i64, Vec<Box<dyn PromiseInterface>>>, wait_index: i64, } impl Loop { pub fn new( - mut http_downloader: HttpDownloader, - process_executor: Option<ProcessExecutor>, + http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>, + process_executor: Option<std::rc::Rc<std::cell::RefCell<ProcessExecutor>>>, ) -> Self { - http_downloader.enable_async(); + http_downloader.borrow_mut().enable_async(); - let process_executor = process_executor.map(|mut pe| { - pe.enable_async(); + let process_executor = process_executor.map(|pe| { + pe.borrow_mut().enable_async(); pe }); @@ -36,11 +36,13 @@ impl Loop { } } - pub fn get_http_downloader(&self) -> &HttpDownloader { + pub fn get_http_downloader(&self) -> &std::rc::Rc<std::cell::RefCell<HttpDownloader>> { &self.http_downloader } - pub fn get_process_executor(&self) -> Option<&ProcessExecutor> { + pub fn get_process_executor( + &self, + ) -> Option<&std::rc::Rc<std::cell::RefCell<ProcessExecutor>>> { self.process_executor.as_ref() } @@ -66,9 +68,9 @@ impl Loop { if let Some(ref progress) = progress { let mut total_jobs: i64 = 0; - total_jobs += self.http_downloader.count_active_jobs(); + total_jobs += self.http_downloader.borrow_mut().count_active_jobs(None); if let Some(ref pe) = self.process_executor { - total_jobs += pe.count_active_jobs(); + total_jobs += pe.borrow_mut().count_active_jobs(None); } progress.start(total_jobs); } @@ -77,9 +79,9 @@ impl Loop { loop { let mut active_jobs: i64 = 0; - active_jobs += self.http_downloader.count_active_jobs(); + active_jobs += self.http_downloader.borrow_mut().count_active_jobs(None); if let Some(ref pe) = self.process_executor { - active_jobs += pe.count_active_jobs(); + active_jobs += pe.borrow_mut().count_active_jobs(None); } if let Some(ref progress) = progress { |
