pub struct Version { /* private fields */ }Expand description
A version attached to an OS or to an environment.
Minor and patch are optional and absent is not zero. macos.13 and macos.13.0 are the
same deployment target, and a version type that normalized one to the other would not round
trip, so both spellings survive formatting and compare equal.
Implementations§
Source§impl Version
impl Version
Sourcepub const fn major(major: u32) -> Self
pub const fn major(major: u32) -> Self
A version with only a major component. linux-gnu.2 is not useful and wasip1 is
exactly this.
Sourcepub const fn new(major: u32, minor: u32) -> Self
pub const fn new(major: u32, minor: u32) -> Self
A two component version, which is what a glibc version is.
Sourcepub const fn full(major: u32, minor: u32, patch: u32) -> Self
pub const fn full(major: u32, minor: u32, patch: u32) -> Self
A three component version, which is what an SDK version is.
Sourcepub const fn major_part(self) -> u32
pub const fn major_part(self) -> u32
The major component.
Sourcepub const fn minor_part(self) -> Option<u32>
pub const fn minor_part(self) -> Option<u32>
The minor component, if the tuple gave one.
Sourcepub const fn patch_part(self) -> Option<u32>
pub const fn patch_part(self) -> Option<u32>
The patch component, if the tuple gave one.
Sourcepub const fn to_triple(self) -> (u32, u32, u32)
pub const fn to_triple(self) -> (u32, u32, u32)
The version as a three component tuple with absent components read as zero, which is the
form to compare in. Do not use it to format: formatting from this loses the distinction
between 13 and 13.0.
Sourcepub const fn at_least(self, other: Version) -> bool
pub const fn at_least(self, other: Version) -> bool
Whether this version is at least other, comparing on the zero filled form.
Sourcepub fn to_llvm_string(self) -> String
pub fn to_llvm_string(self) -> String
The LLVM spelling, which always has three components. macosx13.0.0 rather than
macos.13.