Enum pep440_rs::LocalSegment
source · pub enum LocalSegment {
String(String),
Number(u64),
}
Expand description
A part of the local version identifier
Local versions are a mess:
Comparison and ordering of local versions considers each segment of the local version (divided by a .) separately. If a segment consists entirely of ASCII digits then that section should be considered an integer for comparison purposes and if a segment contains any ASCII letters then that segment is compared lexicographically with case insensitivity. When comparing a numeric and lexicographic segment, the numeric section always compares as greater than the lexicographic segment. Additionally a local version with a great number of segments will always compare as greater than a local version with fewer segments, as long as the shorter local version’s segments match the beginning of the longer local version’s segments exactly.
Luckily the default Ord
implementation for Vec<LocalSegment>
matches the PEP 440 rules.
Variants§
String(String)
Not-parseable as integer segment of local version
Number(u64)
Inferred integer segment of local version
Trait Implementations§
source§impl Clone for LocalSegment
impl Clone for LocalSegment
source§fn clone(&self) -> LocalSegment
fn clone(&self) -> LocalSegment
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for LocalSegment
impl Debug for LocalSegment
source§impl Display for LocalSegment
impl Display for LocalSegment
source§impl Hash for LocalSegment
impl Hash for LocalSegment
source§impl Ord for LocalSegment
impl Ord for LocalSegment
source§impl PartialEq for LocalSegment
impl PartialEq for LocalSegment
source§fn eq(&self, other: &LocalSegment) -> bool
fn eq(&self, other: &LocalSegment) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for LocalSegment
impl PartialOrd for LocalSegment
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more