blob: e87773507ae55fd7a244bacf62e29ca6f9a83366 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
//! ref: composer/vendor/composer/semver/src/Constraint/MatchAllConstraint.php
use crate::constraint::bound::Bound;
use crate::constraint::constraint_interface::ConstraintInterface;
#[derive(Debug)]
pub struct MatchAllConstraint {
pub(crate) pretty_string: Option<String>,
}
impl ConstraintInterface for MatchAllConstraint {
fn matches(&self, _provider: &dyn ConstraintInterface) -> bool {
true
}
fn compile(&self, _other_operator: i64) -> String {
"true".to_string()
}
fn set_pretty_string(&mut self, pretty_string: Option<String>) {
self.pretty_string = pretty_string;
}
fn get_pretty_string(&self) -> String {
if let Some(ref s) = self.pretty_string {
if !s.is_empty() {
return s.clone();
}
}
self.__to_string()
}
fn __to_string(&self) -> String {
"*".to_string()
}
fn get_upper_bound(&self) -> Bound {
Bound::positive_infinity()
}
fn get_lower_bound(&self) -> Bound {
Bound::zero()
}
}
|