tinymist_package/registry/dummy.rs
1//! Dummy package registry implementation for testing purposes.
2
3use std::{path::Path, sync::Arc};
4
5use tinymist_std::ImmutPath;
6
7use super::{PackageError, PackageRegistry, PackageSpec};
8
9/// Dummy package registry that always returns a `NotFound` error.
10#[derive(Default, Debug)]
11pub struct DummyRegistry;
12
13impl DummyRegistry {
14 /// Get data & cache dir (empty)
15 pub fn paths(&self) -> Vec<ImmutPath> {
16 vec![]
17 }
18}
19
20impl PackageRegistry for DummyRegistry {
21 fn resolve(&self, spec: &PackageSpec) -> Result<Arc<Path>, PackageError> {
22 Err(PackageError::NotFound(spec.clone()))
23 }
24}