#[non_exhaustive]pub struct Version {
pub major: u32,
pub minor: u32,
pub patch: u32,
pub build: Option<u32>,
pub text: &'static str,
}Expand description
A version number, with the original text kept: 24.04 stays 24.04.
Ordering compares the numbers, then the text.
if let Some(v) = sys_lib::os::version() {
println!("{v} = {}.{}.{}", v.major, v.minor, v.patch);
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.major: u32The first number.
minor: u32The second number, 0 when absent.
patch: u32The third number, 0 when absent.
build: Option<u32>A fourth number (the Windows update revision, for example).
text: &'static strThe text the numbers came from.
Trait Implementations§
impl Copy for Version
impl Eq for Version
Source§impl Ord for Version
impl Ord for Version
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Version
impl PartialOrd for Version
impl StructuralPartialEq for Version
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnsafeUnpin for Version
impl UnwindSafe for Version
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