Struct recital::version::Version
[−]
[src]
pub struct Version { pub major: u64, pub minor: u64, pub patch: u64, pub pre: Vec<Identifier>, pub build: Vec<Identifier>, }
Represents a semantic version number.
A semantic version number is a version number that conforms to a set of rules and requirements that have been defined in the Semantic Versioning specification. You may find the specification online at semver.org.
Fields
major: u64
The major version number.
A major version number is used to indicate that a paritcular version is
backward compatible with all other version numbers from the same major
version number. For example, 1.999.999
is backwards compatible with
1.0.0
, however 2.0.0
is not backwards compatible with 1.999.999
.
minor: u64
The minor version number.
A minor version number is used to indicate that one or more features have been added that are compatible with earlier versions of the same major version number.
patch: u64
The patch version number.
A patch version number is used to indicate that one or more bugs have been fixed, but no new features have been added and compatibility with earlier versions of the same major version number is maintained.
pre: Vec<Identifier>
The pre-release identifiers.
The pre-release identifiers are used to indicate that this version
number is not stable. While the identifiers can be as many as you want
with whatever information you want, you will most commonly find people
use identifiers such as -alpha
, -beta.3
, -rc.1
, and so on. There
may also be no identifiers, which indicates that this may be a stable
version number.
build: Vec<Identifier>
The build identifiers.
The build identifiers do not mean anything in a semantic version
number. While they are structured similarly (+debug
, +xyz.123
,
etc.), they have no impact when comparing version numbers. They are
mostly there to help developers identify other bits of information.
Methods
impl Version
[src]
fn clear_build(&mut self)
Removes all of the build identifiers.
fn clear_identifiers(&mut self)
Removes all of the pre-release and build identifiers.
fn clear_pre(&mut self)
Removes all of the pre-release identifiers.
fn increment_major(&mut self)
Increments the major version number.
When a major version number is incremented, the minor and patch version numbers are set to zero. In addition, the pre-release and build identifiers are all removed.
fn increment_minor(&mut self)
Increments the minor version number.
When a minor version number is incremented, the patch version number is set to zero. In addition, the pre-release and build identifiers are all removed.
fn increment_patch(&mut self)
Increments the patch version number.
When a patch version number is incremented, the pre-release and build identifiers are all removed.
fn is_stable(&self) -> bool
Checks if the version number is stable.
A version number is considered stable when it has a major version
number that is greater than zero (0
) and has no pre-release
identifiers.
fn new() -> Version
Creates a new version number with default values.
Trait Implementations
impl Clone for Version
[src]
fn clone(&self) -> Version
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Version
[src]
impl Eq for Version
[src]
impl Default for Version
[src]
Sets the default values for a Version
.
use recital::version::Version; let defaults = Version { major: 0, minor: 0, patch: 0, pre: Vec::new(), build: Vec::new(), };
impl Display for Version
[src]
impl Ord for Version
[src]
fn cmp(&self, other: &Version) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialEq for Version
[src]
fn eq(&self, other: &Version) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd for Version
[src]
fn partial_cmp(&self, other: &Version) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl FromStr for Version
[src]
Enables parsing of strings as semantic version numbers.
let example: Version = "1.2.3-abc.456+def.789".parse().unwrap();