Enum mcvm_shared::versions::VersionPattern
source · pub enum VersionPattern {
Single(String),
Latest(Option<String>),
Before(String),
After(String),
Range(String, String),
Any,
}
Expand description
Pattern matching for the version of Minecraft, a package, etc.
Variants§
Single(String)
Matches a single version
Latest(Option<String>)
Matches the latest version in the list
Before(String)
Matches any version that is <= a version
After(String)
Matches any version that is >= a version
Range(String, String)
Matches any versions between an inclusive range
Any
Matches any version
Implementations§
source§impl VersionPattern
impl VersionPattern
sourcepub fn get_matches(&self, versions: &[String]) -> Vec<String>
pub fn get_matches(&self, versions: &[String]) -> Vec<String>
Finds all match in a list of versions
sourcepub fn get_match(&self, versions: &[String]) -> Option<String>
pub fn get_match(&self, versions: &[String]) -> Option<String>
Finds the newest match in a list of versions
sourcepub fn matches_single(&self, version: &str, versions: &[String]) -> bool
pub fn matches_single(&self, version: &str, versions: &[String]) -> bool
Compares this pattern to a single string. For some pattern types, this may return false if it is unable to deduce an answer from the list of versions provided.
sourcepub fn matches_info(&self, version_info: &VersionInfo) -> bool
pub fn matches_info(&self, version_info: &VersionInfo) -> bool
Compares this pattern to a version supplied in a VersionInfo
Trait Implementations§
source§impl Clone for VersionPattern
impl Clone for VersionPattern
source§fn clone(&self) -> VersionPattern
fn clone(&self) -> VersionPattern
Returns a copy 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 VersionPattern
impl Debug for VersionPattern
source§impl<'de> Deserialize<'de> for VersionPattern
impl<'de> Deserialize<'de> for VersionPattern
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for VersionPattern
impl Display for VersionPattern
source§impl Hash for VersionPattern
impl Hash for VersionPattern
source§impl Ord for VersionPattern
impl Ord for VersionPattern
source§fn cmp(&self, other: &VersionPattern) -> Ordering
fn cmp(&self, other: &VersionPattern) -> 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 VersionPattern
impl PartialEq for VersionPattern
source§fn eq(&self, other: &VersionPattern) -> bool
fn eq(&self, other: &VersionPattern) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for VersionPattern
impl PartialOrd for VersionPattern
source§fn partial_cmp(&self, other: &VersionPattern) -> Option<Ordering>
fn partial_cmp(&self, other: &VersionPattern) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for VersionPattern
impl Serialize for VersionPattern
impl Eq for VersionPattern
impl StructuralPartialEq for VersionPattern
Auto Trait Implementations§
impl Freeze for VersionPattern
impl RefUnwindSafe for VersionPattern
impl Send for VersionPattern
impl Sync for VersionPattern
impl Unpin for VersionPattern
impl UnwindSafe for VersionPattern
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