Struct Version Copy item path Source pub struct Version {
pub major: u16 ,
pub minor: u16 ,
pub patch: u16 ,
}Expand description A project version (major[.minor[.patch]]).
Constructed only via Version::parse , so a malformed literal is a compile
error when used in a const. Ordered, which makes since <= THIS_VERSION
a checkable invariant rather than a comment.
const V: Version = Version::parse("2.1" );
assert_eq! (V.to_string(), "2.1.0" );
assert! (Version::parse("2.1" ) < Version::parse("2.2" ));Minor component (0 when omitted).
Patch component (0 when omitted).
Parse major[.minor[.patch]] in a const context.
A semantic-version pre-release or build suffix (0.2.0-rc1, 1.0.0+d34d)
is accepted and ignored: only the numeric core is retained, so ordering
compares releases rather than release-candidate labels. This matters
because THIS_VERSION parses the crate’s own version, and a project
that tags a pre-release must still compile.
§ Panics
At compile time (in a const) for a non-numeric character in the
numeric core, more than three components, or an empty string.
Fallible runtime parse (for data read from JSON rather than authored).
Accepts and ignores a pre-release or build suffix, as Version::parse does.
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Formats the value using the given formatter.
Read more Compares and returns the maximum of two values.
Read more Compares and returns the minimum of two values.
Read more Restrict a value to a certain interval.
Read more 🔬 This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range.
Read more This method returns an ordering between
self and
other values if one exists.
Read more Tests less than (for
self and
other) and is used by the
< operator.
Read more Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more Tests greater than (for
self and
other) and is used by the
>
operator.
Read more Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more Converts the given value to a
String.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.