From 60bfd667e4a98f5463a5bd5f2d0259bd0eeb0a5e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 3 Jun 2026 23:06:16 +0900 Subject: feat(downloader): wire as_* downcasts for file/archive/path/git downloaders Override DownloaderInterface's as_change_report_interface / as_vcs_capable_downloader_interface / as_dvcs_downloader_interface so PHP-style instanceof checks resolve to the concrete sub-interface: FileDownloader and the six archive downloaders (Zip/Tar/Gzip/Xz/Rar/Phar) plus PathDownloader gain ChangeReportInterface (archives/path delegate to the inner FileDownloader), PathDownloader exposes VcsCapableDownloaderInterface, and GitDownloader exposes DvcsDownloaderInterface. The default None impls remain correct for downloaders that do not implement a given sub-interface, so their stale TODO markers are dropped. VCS downloaders' ChangeReport/VcsCapable conformance follows separately. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/downloader/downloader_interface.rs | 3 --- 1 file changed, 3 deletions(-) (limited to 'crates/shirabe/src/downloader/downloader_interface.rs') diff --git a/crates/shirabe/src/downloader/downloader_interface.rs b/crates/shirabe/src/downloader/downloader_interface.rs index 986db28..873438e 100644 --- a/crates/shirabe/src/downloader/downloader_interface.rs +++ b/crates/shirabe/src/downloader/downloader_interface.rs @@ -80,19 +80,16 @@ pub trait DownloaderInterface: std::fmt::Debug { prev_package: Option, ) -> anyhow::Result>; - /// TODO(phase-b): runtime downcast helpers for PHP `instanceof` checks. fn as_change_report_interface(&self) -> Option<&dyn crate::downloader::ChangeReportInterface> { None } - /// TODO(phase-b): runtime downcast helpers for PHP `instanceof` checks. fn as_vcs_capable_downloader_interface( &self, ) -> Option<&dyn crate::downloader::VcsCapableDownloaderInterface> { None } - /// TODO(phase-b): runtime downcast helpers for PHP `instanceof` checks. fn as_dvcs_downloader_interface( &self, ) -> Option<&dyn crate::downloader::DvcsDownloaderInterface> { -- cgit v1.3.1