aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-semver/src/interval.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-semver/src/interval.rs')
-rw-r--r--crates/shirabe-semver/src/interval.rs25
1 files changed, 10 insertions, 15 deletions
diff --git a/crates/shirabe-semver/src/interval.rs b/crates/shirabe-semver/src/interval.rs
index b1f3010..7f27514 100644
--- a/crates/shirabe-semver/src/interval.rs
+++ b/crates/shirabe-semver/src/interval.rs
@@ -1,8 +1,6 @@
//! ref: composer/vendor/composer/semver/src/Interval.php
-use std::sync::OnceLock;
-
-use crate::constraint::Constraint;
+use crate::constraint::SimpleConstraint;
#[derive(Debug, Clone)]
pub struct DevConstraintSet {
@@ -12,32 +10,29 @@ pub struct DevConstraintSet {
#[derive(Debug, Clone)]
pub struct Interval {
- start: Constraint,
- end: Constraint,
+ start: SimpleConstraint,
+ end: SimpleConstraint,
}
impl Interval {
- pub fn new(start: Constraint, end: Constraint) -> Self {
+ pub fn new(start: SimpleConstraint, end: SimpleConstraint) -> Self {
Self { start, end }
}
- pub fn get_start(&self) -> &Constraint {
+ pub fn get_start(&self) -> &SimpleConstraint {
&self.start
}
- pub fn get_end(&self) -> &Constraint {
+ pub fn get_end(&self) -> &SimpleConstraint {
&self.end
}
- pub fn from_zero() -> &'static Constraint {
- static ZERO: OnceLock<Constraint> = OnceLock::new();
- ZERO.get_or_init(|| Constraint::new(">=".to_string(), "0.0.0.0-dev".to_string()))
+ pub fn from_zero() -> SimpleConstraint {
+ SimpleConstraint::new(">=".to_string(), "0.0.0.0-dev".to_string(), None)
}
- pub fn until_positive_infinity() -> &'static Constraint {
- static POSITIVE_INFINITY: OnceLock<Constraint> = OnceLock::new();
- POSITIVE_INFINITY
- .get_or_init(|| Constraint::new("<".to_string(), format!("{}.0.0.0", i64::MAX)))
+ pub fn until_positive_infinity() -> SimpleConstraint {
+ SimpleConstraint::new("<".to_string(), format!("{}.0.0.0", i64::MAX), None)
}
pub fn any() -> Self {