[][src]Struct semver_constraints::Constraint

pub struct Constraint { /* fields omitted */ }

A set of Ranges combines to make a Constraint. Constraints are the union of multiple Ranges. Upon manual creation or updating of a Constraint, the Constraint will unify all of its Ranges such that all of the Ranges are disjoint. Unification is eager: it's done whenever the set is modified to keep the internal representation of the set unified at all times (this is useful for converting the Constraint to a string, since the Display trait doesn't allow mutating self).

Syntax-wise, a Constraint is just a list of comma-separated ranges.

Methods

impl Constraint[src]

pub fn new(ranges: IndexSet<Range>) -> Constraint[src]

Creates a new Constraint from a set of Ranges.

pub fn empty() -> Constraint[src]

pub fn any() -> Constraint[src]

pub fn insert(&mut self, range: Range)[src]

Inserts a Range into the set.

pub fn retrieve(&self) -> &IndexSet<Range>[src]

Borrows the set of Ranges from this struct, unifying it in the process.

pub fn take(self) -> IndexSet<Range>[src]

Takes the set of Ranges from this struct, unifying it in the process.

pub fn unify(&mut self)[src]

Unifies all of the ranges in the set such that all of the ranges are disjoint.

pub fn is_empty(&self) -> bool[src]

pub fn satisfies(&self, v: &Version) -> bool[src]

Checks if a Version is satisfied by this Constraint.

pub fn intersection(&self, other: &Constraint) -> Constraint[src]

pub fn union(&self, other: &Constraint) -> Constraint[src]

pub fn difference(&self, other: &Constraint) -> Constraint[src]

pub fn complement(&self) -> Constraint[src]

pub fn relation(&self, other: &Constraint) -> Relation[src]

Trait Implementations

impl PartialEq<Constraint> for Constraint[src]

impl Default for Constraint[src]

impl From<Range> for Constraint[src]

impl From<Version> for Constraint[src]

impl Clone for Constraint[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for Constraint[src]

impl Display for Constraint[src]

impl Debug for Constraint[src]

impl FromStr for Constraint[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for Constraint

impl Sync for Constraint

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<Q, K> Equivalent for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]