pub struct CompareVersion;
Expand description
Utility for comparing version strings.
Provides methods for version comparison and range matching.
Implementations§
Source§impl CompareVersion
impl CompareVersion
Sourcepub fn compare_version(
version1: &str,
version2: &str,
) -> Result<VersionComparison, VersionError>
pub fn compare_version( version1: &str, version2: &str, ) -> Result<VersionComparison, VersionError>
Compares two version strings and returns a VersionComparison
enum.
§Arguments
&str
- The first version string to compare.&str
- The second version string to compare.
§Returns
Result<VersionComparison, VersionError>
- AResult
indicating the comparison result on success, or aVersionError
on failure.
Sourcepub fn matches_version_range(
version: &str,
range: &str,
) -> Result<bool, VersionError>
pub fn matches_version_range( version: &str, range: &str, ) -> Result<bool, VersionError>
Checks whether a version matches a specified range, supporting ^
and ~
ranges.
§Arguments
&str
- The version string to check.&str
- The version range string to match against.
§Returns
Result<bool, VersionError>
- AResult
indicating whether the version matches the range on success, or aVersionError
on failure.
Trait Implementations§
Source§impl Clone for CompareVersion
impl Clone for CompareVersion
Source§fn clone(&self) -> CompareVersion
fn clone(&self) -> CompareVersion
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for CompareVersion
impl RefUnwindSafe for CompareVersion
impl Send for CompareVersion
impl Sync for CompareVersion
impl Unpin for CompareVersion
impl UnwindSafe for CompareVersion
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