diff options
Diffstat (limited to 'crates/shirabe/src/repository/path_repository.rs')
| -rw-r--r-- | crates/shirabe/src/repository/path_repository.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/shirabe/src/repository/path_repository.rs b/crates/shirabe/src/repository/path_repository.rs index d7f24fa7..879b769c 100644 --- a/crates/shirabe/src/repository/path_repository.rs +++ b/crates/shirabe/src/repository/path_repository.rs @@ -141,7 +141,7 @@ impl PathRepository { ) -> anyhow::Result<bool> { self.initialize()?; use crate::repository::RepositoryInterface; - Ok(self.inner.has_package(package)) + self.inner.has_package(package) } // In PHP the inherited ArrayRepository methods lazily call the overridden initialize() to glob @@ -397,16 +397,13 @@ impl RepositoryInterface for PathRepository { // The structural methods are inherited from ArrayRepository in PHP, where the lazy package load // is driven by the overridden initialize(). Here each one first ensures that load has happened // (see ensure_initialized), then delegates to the inner ArrayRepository. - fn count(&self) -> anyhow::Result<usize> { + fn count(&mut self) -> anyhow::Result<usize> { self.ensure_initialized()?; self.inner.count() } - fn has_package(&self, package: PackageInterfaceHandle) -> bool { - // TODO(phase-d): hasPackage returns bool and cannot surface an initialization error; a - // failed load leaves the inner repository with whatever packages were added before the - // failure. - let _ = self.ensure_initialized(); + fn has_package(&mut self, package: PackageInterfaceHandle) -> anyhow::Result<bool> { + self.ensure_initialized()?; self.inner.has_package(package) } |
