Struct debian_packaging::package_version::PackageVersion
source · [−]pub struct PackageVersion { /* private fields */ }Expand description
A Debian package version.
Debian package versions consist of multiple sub-components and have rules about sorting. The semantics are defined at https://www.debian.org/doc/debian-policy/ch-controlfields.html#version. This type attempts to implement all the details.
The concise version is the format is [epoch:]upstream_version[-debian_revision]
and each component has rules about what characters are allowed. Our
Self::parse() should be compliant with the specification and reject invalid
version strings and parse components to the appropriate field.
This type implements a custom ordering function that implements the complex rules around Debian package version ordering.
use debian_packaging::package_version::PackageVersion;
let v = PackageVersion::parse("1:4.7.0+dfsg1-2").unwrap();
assert_eq!(v.epoch(), Some(1));
assert_eq!(v.upstream_version(), "4.7.0+dfsg1");
assert_eq!(v.debian_revision(), Some("2"));
assert_eq!(format!("{}", v), "1:4.7.0+dfsg1-2");
assert!(v < PackageVersion::parse("1:4.7.0+dfsg1-3").unwrap());Implementations
The epoch component of the version string.
Only Some if present or defined explicitly.
Assumed value of epoch component.
If the component isn’t explicitly defined, a default of 0 will be assumed.
upstream component of the version string.
This is the main part of the version number.
It is typically the original version of the software from which this package came. Although it may be massaged to be compatible with packaging requirements.
debian_revision component of the version string.
The part of the version string that specifies the version of the Debian package based on the upstream version.
Trait Implementations
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for PackageVersion
impl Send for PackageVersion
impl Sync for PackageVersion
impl Unpin for PackageVersion
impl UnwindSafe for PackageVersion
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more