pub enum BuildToolVersion {
Makepkg(MinimalVersion),
DevTools {
version: FullVersion,
architecture: Architecture,
},
}Expand description
The version and optional architecture of a build tool.
BuildToolVersion is used in conjunction with BuildTool to denote the specific build tool
a package is built with.
BuildToolVersion distinguishes between two types of representations:
- the one used by makepkg, which relies on
MinimalVersion - and the one used by pkgctl (devtools), which relies on
FullVersionand theArchitectureof the build tool.
For more information refer to the buildtoolver keyword in BUILDINFOv2.
§Examples
use std::str::FromStr;
use alpm_types::{Architecture, BuildToolVersion, FullVersion, MinimalVersion};
// Representation used by makepkg
assert_eq!(
BuildToolVersion::from_str("1.0.0")?,
BuildToolVersion::Makepkg(MinimalVersion::from_str("1.0.0")?)
);
assert_eq!(
BuildToolVersion::from_str("1:1.0.0")?,
BuildToolVersion::Makepkg(MinimalVersion::from_str("1:1.0.0")?)
);
// Representation used by pkgctl
assert_eq!(
BuildToolVersion::from_str("1.0.0-1-any")?,
BuildToolVersion::DevTools {
version: FullVersion::from_str("1.0.0-1")?,
architecture: Architecture::from_str("any")?
}
);
assert_eq!(
BuildToolVersion::from_str("1:1.0.0-1-any")?,
BuildToolVersion::DevTools {
version: FullVersion::from_str("1:1.0.0-1")?,
architecture: Architecture::from_str("any")?
}
);Variants§
Makepkg(MinimalVersion)
The version representation used by makepkg.
DevTools
The version representation used by pkgctl (devtools).
Fields
§
version: FullVersionThe (full or full with epoch) version of the build tool.
§
architecture: ArchitectureThe architecture of the build tool.
Implementations§
Source§impl BuildToolVersion
impl BuildToolVersion
Sourcepub fn architecture(&self) -> Option<Architecture>
pub fn architecture(&self) -> Option<Architecture>
Returns the optional Architecture.
§Note
If self is a BuildToolVersion::Makepkg this method always returns None.
Sourcepub fn version(&self) -> Version
pub fn version(&self) -> Version
Returns a Version that matches the underlying MinimalVersion or FullVersion.
Trait Implementations§
Source§impl Clone for BuildToolVersion
impl Clone for BuildToolVersion
Source§fn clone(&self) -> BuildToolVersion
fn clone(&self) -> BuildToolVersion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BuildToolVersion
impl Debug for BuildToolVersion
Source§impl Display for BuildToolVersion
impl Display for BuildToolVersion
Source§impl FromStr for BuildToolVersion
impl FromStr for BuildToolVersion
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a BuildToolVersion from a string slice.
§Errors
Returns an error if
scontains no ‘-’ andsis not a validMinimalVersion,- or
scontains at least one ‘-’ and after splitting on the right most occurrence, either the left-hand side is not a validFullVersionor the right hand side is not a validArchitecture.
Source§impl Ord for BuildToolVersion
impl Ord for BuildToolVersion
Source§fn cmp(&self, other: &BuildToolVersion) -> Ordering
fn cmp(&self, other: &BuildToolVersion) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for BuildToolVersion
impl PartialEq for BuildToolVersion
Source§impl PartialOrd for BuildToolVersion
impl PartialOrd for BuildToolVersion
Source§impl Serialize for BuildToolVersion
impl Serialize for BuildToolVersion
impl Eq for BuildToolVersion
impl StructuralPartialEq for BuildToolVersion
Auto Trait Implementations§
impl Freeze for BuildToolVersion
impl RefUnwindSafe for BuildToolVersion
impl Send for BuildToolVersion
impl Sync for BuildToolVersion
impl Unpin for BuildToolVersion
impl UnwindSafe for BuildToolVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more