Enum version_number::Version
source · pub enum Version {
Base(BaseVersion),
Full(FullVersion),
}
Expand description
A numbered version which is a two-component major.minor
version number,
or a three-component major.minor.patch
version number.
Variants§
Base(BaseVersion)
A two-component major.minor
version.
Full(FullVersion)
A three-component major.minor.patch
version.
Implementations§
source§impl Version
impl Version
sourcepub fn parse(input: &str) -> Result<Self, Error>
pub fn parse(input: &str) -> Result<Self, Error>
Parse a two- or three-component, major.minor
or major.minor.patch
respectively,
version number from a given input.
Returns a Error::ParserError
if it fails to parse.
sourcepub fn new_base_version(major: u64, minor: u64) -> Self
pub fn new_base_version(major: u64, minor: u64) -> Self
Create a new two-component major.minor
version number.
sourcepub fn new_full_version(major: u64, minor: u64, patch: u64) -> Self
pub fn new_full_version(major: u64, minor: u64, patch: u64) -> Self
Create a new three-component major.minor.patch
version number.
sourcepub fn major(&self) -> u64
pub fn major(&self) -> u64
Returns the major
version component.
Both the two- and three-component version number variants have a major version. This is the leading component.
sourcepub fn minor(&self) -> u64
pub fn minor(&self) -> u64
Returns the minor
version component.
Both the two- and three-component version number variants have a minor version. This is the middle component.