pub struct JavaSpec {
pub vendor: Option<String>,
pub version: Option<VersionReq>,
pub arch: Option<String>,
pub raw: String,
}Expand description
A parsed Java installation query spec.
Fields§
§vendor: Option<String>Vendor substring to match (case-insensitive).
version: Option<VersionReq>Version requirement.
arch: Option<String>Architecture substring to match (case-insensitive).
raw: StringThe raw input string.
Implementations§
Source§impl JavaSpec
impl JavaSpec
Sourcepub fn parse(input: &str) -> Result<Self, String>
pub fn parse(input: &str) -> Result<Self, String>
Parse a human-readable Java spec string.
§Format
<vendor> v<constraint> a<arch>
Both v and a prefixes and their values are optional.
§Examples
use java_manager::JavaSpec;
let spec = JavaSpec::parse("Eclipse Adoptium v^17.0.0 ax86_64").unwrap();
assert_eq!(spec.vendor.as_deref(), Some("Eclipse Adoptium"));
assert!(spec.version.is_some());
assert_eq!(spec.arch.as_deref(), Some("x86_64"));Sourcepub fn matches(&self, info: &JavaInfo) -> bool
pub fn matches(&self, info: &JavaInfo) -> bool
Check whether a [JavaInfo] matches this spec.
All present criteria (vendor, version, architecture) must match. Missing criteria are ignored (i.e., a spec with no vendor matches any vendor).
Vendor matching is case-insensitive substring. Architecture matching is case-insensitive substring.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JavaSpec
impl RefUnwindSafe for JavaSpec
impl Send for JavaSpec
impl Sync for JavaSpec
impl Unpin for JavaSpec
impl UnsafeUnpin for JavaSpec
impl UnwindSafe for JavaSpec
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