pub struct Version {
pub epoch: Option<u32>,
pub upstream_version: String,
pub debian_revision: Option<String>,
}Expand description
A Debian version string
Fields§
§epoch: Option<u32>The epoch of the version, if any
upstream_version: StringThe upstream version
debian_revision: Option<String>The Debian revision, if any
Implementations§
Source§impl Version
impl Version
Sourcepub fn is_bin_nmu(&self) -> bool
pub fn is_bin_nmu(&self) -> bool
Is this a binNMU?
A binNMU is a binary-only NMU (Non-Maintainer Upload) where the source package is not changed.
Note that this checks for the presence of the +b[:digit:] suffix, which is not part of the Debian
Policy Manual, but it is commonly used to indicate a binNMU.
§Examples
use debversion::Version;
assert!("1.0+b1".parse::<Version>().unwrap().is_bin_nmu());
assert!("1.0-1+b1".parse::<Version>().unwrap().is_bin_nmu());
assert!(!"1.0-1".parse::<Version>().unwrap().is_bin_nmu());
assert!(!"1.0".parse::<Version>().unwrap().is_bin_nmu());Sourcepub fn bin_nmu_count(&self) -> Option<i32>
pub fn bin_nmu_count(&self) -> Option<i32>
Return the binNMU count of this version
This will return the binNMU count of this version, or None if this is not a binNMU.
Sourcepub fn increment_bin_nmu(self) -> Version
pub fn increment_bin_nmu(self) -> Version
Create a binNMU version from this version
This will increment the binNMU suffix by one, or add a +b1 suffix if there is no binNMU
suffix.
Sourcepub fn is_nmu(&self) -> bool
pub fn is_nmu(&self) -> bool
Check if this version is a sourceful NMU
A sourceful NMU is a Non-Maintainer Upload where the source package is changed.
This is indicated by the presence of a +nmu[:digit:] suffix.
This is not part of the Debian Policy Manual, but it is commonly used to indicate a
sourceful NMU.
Sourcepub fn nmu_count(&self) -> Option<i32>
pub fn nmu_count(&self) -> Option<i32>
Return the sourceful NMU count of this version
This will return the sourceful NMU count of this version, or None if this is not a sourceful NMU.
Sourcepub fn canonicalize(&self) -> Version
pub fn canonicalize(&self) -> Version
Return canonicalized version of this version
§Examples
use debversion::Version;
assert_eq!("1.0-0".parse::<Version>().unwrap().canonicalize(), "1.0".parse::<Version>().unwrap());
assert_eq!("1.0-1".parse::<Version>().unwrap().canonicalize(), "1.0-1".parse::<Version>().unwrap());Sourcepub fn increment_debian(&mut self)
pub fn increment_debian(&mut self)
Increment the Debian revision.
For native packages, increment the upstream version number. For other packages, increment the debian revision.