pub struct SingleConstraint { /* private fields */ }Expand description
A single version constraint (e.g., >=1.0.0, <2.0.0, ==1.5.0).
Implementations§
Source§impl SingleConstraint
impl SingleConstraint
Sourcepub fn new(operator: Operator, version: impl Into<String>) -> Self
pub fn new(operator: Operator, version: impl Into<String>) -> Self
Create a new single constraint.
Sourcepub fn is_dev_branch(&self) -> bool
pub fn is_dev_branch(&self) -> bool
Check if this version is a dev branch (starts with “dev-”).
Sourcepub fn match_specific(&self, other: &Self, compare_branches: bool) -> bool
pub fn match_specific(&self, other: &Self, compare_branches: bool) -> bool
Match against another single constraint.
This implements the core matching logic from PHP’s Constraint::matchSpecific.
Trait Implementations§
Source§impl Clone for SingleConstraint
impl Clone for SingleConstraint
Source§fn clone(&self) -> SingleConstraint
fn clone(&self) -> SingleConstraint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Constraint for SingleConstraint
impl Constraint for SingleConstraint
Source§fn matches(&self, other: &dyn Constraint) -> bool
fn matches(&self, other: &dyn Constraint) -> bool
Check if this constraint matches/intersects with another.
Source§fn lower_bound(&self) -> Bound
fn lower_bound(&self) -> Bound
Get the lower bound of this constraint.
Source§fn upper_bound(&self) -> Bound
fn upper_bound(&self) -> Bound
Get the upper bound of this constraint.
Source§fn set_pretty_string(&mut self, pretty: String)
fn set_pretty_string(&mut self, pretty: String)
Set a custom pretty string (for preserving user input).
Source§fn pretty_string(&self) -> String
fn pretty_string(&self) -> String
Get a human-readable representation.
Source§fn as_single(&self) -> Option<&SingleConstraint>
fn as_single(&self) -> Option<&SingleConstraint>
Try to downcast to
SingleConstraint.Source§fn is_match_all(&self) -> bool
fn is_match_all(&self) -> bool
Check if this is a
MatchAllConstraint.Source§fn is_match_none(&self) -> bool
fn is_match_none(&self) -> bool
Check if this is a
MatchNoneConstraint.Source§fn as_multi(&self) -> Option<&MultiConstraint>
fn as_multi(&self) -> Option<&MultiConstraint>
Try to downcast to
MultiConstraint.Source§impl Debug for SingleConstraint
impl Debug for SingleConstraint
Auto Trait Implementations§
impl Freeze for SingleConstraint
impl RefUnwindSafe for SingleConstraint
impl Send for SingleConstraint
impl Sync for SingleConstraint
impl Unpin for SingleConstraint
impl UnwindSafe for SingleConstraint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more