Examples for parsing values, mostly using nom
.
Exposes a SemanticVersion
struct which is defined like this:
pub struct SemanticVersion {
pub major: u64,
pub minor: u64,
pub bugfix: Option<u64>,
}
This type implements Display
, FromStr
, serde::Deserialize
and serde::Serialize
, and clap
support is included
and tested. The prefixed
method will construct a semantic version string with a v
prefix.
Values can be constructed using FromStr
and from SemanticVersion::parse
, as well as with all three components using
SemanticVersion::new
, or with only two components with SemanticVersion::abridged
.
Parsing is done via nom
, and should be extraordinarily fast.
String inputs should be of the forms:
v1.2.3
v0.1
1.2.3
0.1
String outputs will follow the same format yet will not be prefixed with a v
unless SemanticVersion::prefixed
is
used.
Consult the module doc-strings for more information as well as the source code.