Enum alpm_types::VersionComparison
source · pub enum VersionComparison {
Less,
LessOrEqual,
Equal,
GreaterOrEqual,
Greater,
}
Expand description
Specifies the comparison function for a VersionRequirement
.
The package version can be required to be:
- less than (
<
) - less than or equal to (
<=
) - equal to (
=
) - greater than or equal to (
>=
) - greater than (
>
) than the specified version.
Variants§
Implementations§
source§impl VersionComparison
impl VersionComparison
sourcefn is_compatible_with(self, ord: Ordering) -> bool
fn is_compatible_with(self, ord: Ordering) -> bool
Returns true
if the result of a comparison between the actual and required package versions
satisfies the comparison function.
§Examples
ⓘ
use alpm_types::{Version, VersionComparison};
let actual_version = Version::new("1.3").unwrap();
let required_version = Version::new("1.5").unwrap();
let required_comparison = VersionComparison::GreaterOrEqual;
let comparison = actual_version.cmp(&required_version);
assert!(!required_comparison.is_compatible_with(comparison));
Trait Implementations§
source§impl Clone for VersionComparison
impl Clone for VersionComparison
source§fn clone(&self) -> VersionComparison
fn clone(&self) -> VersionComparison
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 VersionComparison
impl Debug for VersionComparison
source§impl FromStr for VersionComparison
impl FromStr for VersionComparison
source§impl PartialEq for VersionComparison
impl PartialEq for VersionComparison
source§fn eq(&self, other: &VersionComparison) -> bool
fn eq(&self, other: &VersionComparison) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for VersionComparison
impl Eq for VersionComparison
impl StructuralPartialEq for VersionComparison
Auto Trait Implementations§
impl Freeze for VersionComparison
impl RefUnwindSafe for VersionComparison
impl Send for VersionComparison
impl Sync for VersionComparison
impl Unpin for VersionComparison
impl UnwindSafe for VersionComparison
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