aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package/version/version_parser.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-20 08:33:49 +0900
committernsfisis <nsfisis@gmail.com>2026-05-20 08:33:57 +0900
commitf31b101ce1e921a026ba234b1f0a83b0392bc118 (patch)
treeb7ac2aa84d71ebd162cc21aeab0240e7e0544988 /crates/shirabe/src/package/version/version_parser.rs
parent5e31fa33c3b5cf726a57a063b8e7a070869250fe (diff)
downloadphp-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.tar.gz
php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.tar.zst
php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.zip
fix(compile): fix all remaining compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package/version/version_parser.rs')
-rw-r--r--crates/shirabe/src/package/version/version_parser.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/shirabe/src/package/version/version_parser.rs b/crates/shirabe/src/package/version/version_parser.rs
index 84749a3..4286419 100644
--- a/crates/shirabe/src/package/version/version_parser.rs
+++ b/crates/shirabe/src/package/version/version_parser.rs
@@ -13,7 +13,7 @@ use crate::repository::platform_repository::PlatformRepository;
static CONSTRAINTS: LazyLock<Mutex<IndexMap<String, Arc<dyn ConstraintInterface + Send + Sync>>>> =
LazyLock::new(|| Mutex::new(IndexMap::new()));
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct VersionParser {
inner: SemverVersionParser,
}
@@ -24,13 +24,9 @@ impl VersionParser {
pub fn parse_constraints(
&self,
constraints: &str,
- ) -> anyhow::Result<Arc<dyn ConstraintInterface + Send + Sync>> {
- let mut cache = CONSTRAINTS.lock().unwrap();
- if !cache.contains_key(constraints) {
- let parsed = self.inner.parse_constraints(constraints)?;
- cache.insert(constraints.to_string(), Arc::from(parsed));
- }
- Ok(Arc::clone(cache.get(constraints).unwrap()))
+ ) -> anyhow::Result<Box<dyn ConstraintInterface>> {
+ // TODO(phase-b): re-introduce a memoization cache once trait objects are Send+Sync.
+ self.inner.parse_constraints(constraints)
}
pub fn parse_name_version_pairs(
@@ -92,6 +88,10 @@ impl VersionParser {
SemverVersionParser::parse_stability(version)
}
+ pub fn parse_numeric_alias_prefix(&self, branch: &str) -> Option<String> {
+ self.inner.parse_numeric_alias_prefix(branch)
+ }
+
pub fn is_upgrade(normalized_from: &str, normalized_to: &str) -> anyhow::Result<bool> {
if normalized_from == normalized_to {
return Ok(true);