fn version_compare(version: &Version, requirement: &str) -> bool {
    if requirement.is_empty() {
        return true;
    }

    // Setting Compat::Npm follows the rules here:
    // https://www.npmjs.com/package/semver
    //
    // Most importantly, the requirement "1.2.3" is treated as "= 1.2.3".
    // Without the compat mode, "1.2.3" is treated as "^1.2.3".
    match VersionReq::parse_compat(requirement, Compat::Npm) {
        Ok(req) => {
            return req.matches(version);
        }
        Err(e) => {
            log::error!("SemVer range could not parse: {}", e);
        }
    }
    false
}
/// Check whether the given version is within the legal range.
///
/// An empty range matches anything.
///
/// A range that fails to parse matches nothing.
///
/// An empty version matches nothing (unless the requirement is empty)
///
/// A version that fails to parse matches nothing (unless the requirement is empty).
///
/// In all other cases, if the version satisfies the requirement, this returns true.
/// And if it fails to satisfy the requirement, this returns false.
Check whether the given version is within the legal range.
An empty range matches anything.

A range that fails to parse matches nothing.

An empty version matches nothing (unless the requirement is empty)

A version that fails to parse matches nothing (unless the requirement is empty).

In all other cases, if the version satisfies the requirement, this returns true.
And if it fails to satisfy the requirement, this returns false.
Check whether the given version is within the legal range . An empty range matches anything . A range that fails to parse matches nothing . An empty version matches nothing ( unless the requirement is empty ) A version that fails to parse matches nothing ( unless the requirement is empty ) . In all other cases if the version satisfies the requirement this returns true . And if it fails to satisfy the requirement this returns false .
fn version_compare(version: &Version, requirement: &str) -> bool {
    if requirement.is_empty() {
        return true;
    }
    // Setting Compat::Npm follows the rules here:
    // https://www.npmjs.com/package/semver
    //
    // Most importantly, the requirement "1.2.3" is treated as "= 1.2.3".
    // Without the compat mode, "1.2.3" is treated as "^1.2.3".
    match VersionReq::parse_compat(requirement, Compat::Npm) {
        Ok(req) => {
            return req.matches(version);
        }
        Err(e) => {
            log::error!("SemVer range could not parse: {}", e);
        }
    }
    false
}
fn version_compare ( version : & Version , requirement : & str ) -> bool { if requirement . is_empty ( ) { return true ; } // Setting Compat::Npm follows the rules here: // https://www.npmjs.com/package/semver // // Most importantly, the requirement "1.2.3" is treated as "= 1.2.3". // Without the compat mode, "1.2.3" is treated as "^1.2.3". match VersionReq :: parse_compat ( requirement , Compat :: Npm ) { Ok ( req ) => { return req . matches ( version ) ; } Err ( e ) => { log :: error ! ( " " e ) ; } } false }
Check whether the given version is within the legal range.
Check whether the given version is within the legal range .
version
&Version
requirement
&str
version
&Version
requirement
&str