pub struct JavaVersion {
pub major: u64,
pub minor: u64,
pub patch: u64,
pub raw: String,
}Expand description
Parsed Java version with relaxed extraction of major/minor/patch.
Handles formats like 11.0.2, 1.8.0_202-ea, 17.0.2+13-LTS,
11-ea, and 17.0.8.1 (extra segments are ignored).
The Display implementation renders as {major}.{minor}.{patch},
except when all three are zero — in that case the raw string
is shown as a fallback.
Fields§
§major: u64Major version number (e.g. 11 in 11.0.2).
For legacy Java 8 this is the second component — 1.8.0_202 becomes
major = 8.
minor: u64Minor version number (e.g. 0 in 11.0.2).
Defaults to 0 when only the major component is specified.
patch: u64Patch / security-update version number (e.g. 2 in 11.0.2).
Defaults to 0 when only major and minor are specified.
raw: StringThe raw version string as produced by java -version.
Preserved for display when automatic parsing falls back to 0.0.0.
Implementations§
Trait Implementations§
Source§impl Clone for JavaVersion
impl Clone for JavaVersion
Source§fn clone(&self) -> JavaVersion
fn clone(&self) -> JavaVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JavaVersion
impl Debug for JavaVersion
Source§impl Display for JavaVersion
impl Display for JavaVersion
impl Eq for JavaVersion
Source§impl Ord for JavaVersion
impl Ord for JavaVersion
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for JavaVersion
impl PartialEq for JavaVersion
Source§fn eq(&self, other: &JavaVersion) -> bool
fn eq(&self, other: &JavaVersion) -> bool
self and other values to be equal, and is used by ==.