Struct elba::package::version::Constraint [−][src]
pub struct Constraint { /* fields omitted */ }
A set of Range
s combines to make a Constraint
. Constraint
s are the union of multiple
Range
s. Upon manual creation or updating of a Constraint
, the Constraint
will unify all
of its Range
s such that all of the Range
s 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]
impl Constraint
pub fn new(ranges: IndexSet<Range>) -> Constraint
[src]
pub fn new(ranges: IndexSet<Range>) -> Constraint
Creates a new Constraint
from a set of Range
s.
pub fn empty() -> Constraint
[src]
pub fn empty() -> Constraint
pub fn any() -> Constraint
[src]
pub fn any() -> Constraint
pub fn insert(&mut self, range: Range)
[src]
pub fn insert(&mut self, range: Range)
Inserts a Range
into the set.
pub fn retrieve(&self) -> &IndexSet<Range>
[src]
pub fn retrieve(&self) -> &IndexSet<Range>
Borrows the set of Range
s from this struct, unifying it in the process.
pub fn take(self) -> IndexSet<Range>
[src]
pub fn take(self) -> IndexSet<Range>
Takes the set of Range
s from this struct, unifying it in the process.
pub fn unify(&mut self)
[src]
pub fn unify(&mut self)
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 is_empty(&self) -> bool
pub fn satisfies(&self, v: &Version) -> bool
[src]
pub fn satisfies(&self, v: &Version) -> bool
Checks if a Version
is satisfied by this Constraint
.
pub fn intersection(&self, other: &Constraint) -> Constraint
[src]
pub fn intersection(&self, other: &Constraint) -> Constraint
pub fn union(&self, other: &Constraint) -> Constraint
[src]
pub fn union(&self, other: &Constraint) -> Constraint
pub fn difference(&self, other: &Constraint) -> Constraint
[src]
pub fn difference(&self, other: &Constraint) -> Constraint
pub fn complement(&self) -> Constraint
[src]
pub fn complement(&self) -> Constraint
pub fn relation(&self, other: &Constraint) -> Relation
[src]
pub fn relation(&self, other: &Constraint) -> Relation
Trait Implementations
impl Clone for Constraint
[src]
impl Clone for Constraint
fn clone(&self) -> Constraint
[src]
fn clone(&self) -> Constraint
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Constraint
[src]
impl PartialEq for Constraint
fn eq(&self, other: &Constraint) -> bool
[src]
fn eq(&self, other: &Constraint) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Constraint) -> bool
[src]
fn ne(&self, other: &Constraint) -> bool
This method tests for !=
.
impl Eq for Constraint
[src]
impl Eq for Constraint
impl Default for Constraint
[src]
impl Default for Constraint
impl From<Range> for Constraint
[src]
impl From<Range> for Constraint
fn from(r: Range) -> Constraint
[src]
fn from(r: Range) -> Constraint
Performs the conversion.
impl From<Version> for Constraint
[src]
impl From<Version> for Constraint
fn from(v: Version) -> Constraint
[src]
fn from(v: Version) -> Constraint
Performs the conversion.
impl FromStr for Constraint
[src]
impl FromStr for Constraint
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a string s
to return a value of this type. Read more
impl Debug for Constraint
[src]
impl Debug for Constraint
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Constraint
[src]
impl Display for Constraint
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Serialize for Constraint
[src]
impl Serialize for Constraint
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for Constraint
[src]
impl<'de> Deserialize<'de> for Constraint
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl Send for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Sync for Constraint