aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-semver/src/constraint/constraint_interface.rs
blob: 980a23ae85cfcd4c1cb3a3454df4b74266b09d0f (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
//! ref: composer/vendor/composer/semver/src/Constraint/ConstraintInterface.php

use crate::constraint::bound::Bound;

pub trait ConstraintInterface {
    fn matches(&self, provider: &dyn ConstraintInterface) -> bool;

    fn compile(&self, other_operator: i64) -> String;

    fn get_upper_bound(&self) -> Bound;

    fn get_lower_bound(&self) -> Bound;

    fn get_pretty_string(&self) -> String;

    fn set_pretty_string(&mut self, pretty_string: Option<String>);

    fn __to_string(&self) -> String;

    // Rust-specific helpers for instanceof checks in MultiConstraint::matches and optimizeConstraints.
    fn is_disjunctive(&self) -> bool {
        false
    }

    fn as_any(&self) -> &dyn std::any::Any;
}