Struct semver_parser::range::Predicate [−][src]
pub struct Predicate {
pub op: Op,
pub major: u64,
pub minor: Option<u64>,
pub patch: Option<u64>,
pub pre: Vec<Identifier>,
}Struct representing a version comparison predicate.
Struct contaions operation code and data for comparison of version::Versions.
Examples
Parsing Predicate from string and checking its fields:
use semver_parser::range; let p = range::parse_predicate(">=1.1")?.expect("non-empty"); assert_eq!(p.op, range::Op::GtEq); assert_eq!(p.major, 1); assert_eq!(p.minor.unwrap(), 1); assert!(p.patch.is_none()); assert!(p.pre.is_empty());
Fields
op: Op
Operation code for this predicate, like "greater than" or "exact match".
major: u64
Major version.
minor: Option<u64>
Optional minor version.
patch: Option<u64>
Optional patch version.
pre: Vec<Identifier>
Collection of Identifiers of version, like "alpha1" in "1.2.3-alpha1".
Trait Implementations
impl PartialEq for Predicate[src]
impl PartialEq for Predicatefn eq(&self, other: &Predicate) -> bool[src]
fn eq(&self, other: &Predicate) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Predicate) -> bool[src]
fn ne(&self, other: &Predicate) -> boolThis method tests for !=.
impl Eq for Predicate[src]
impl Eq for Predicateimpl Debug for Predicate[src]
impl Debug for Predicatefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for Predicate[src]
impl Clone for Predicatefn clone(&self) -> Predicate[src]
fn clone(&self) -> PredicateReturns 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 Hash for Predicate[src]
impl Hash for Predicatefn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl PartialOrd for Predicate[src]
impl PartialOrd for Predicatefn partial_cmp(&self, other: &Predicate) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &Predicate) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Predicate) -> bool[src]
fn lt(&self, other: &Predicate) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Predicate) -> bool[src]
fn le(&self, other: &Predicate) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Predicate) -> bool[src]
fn gt(&self, other: &Predicate) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Predicate) -> bool[src]
fn ge(&self, other: &Predicate) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl Ord for Predicate[src]
impl Ord for Predicatefn cmp(&self, other: &Predicate) -> Ordering[src]
fn cmp(&self, other: &Predicate) -> OrderingThis method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more