satisfies
Whether the version version satisfies the requirement requirement, both given as text.
A shortcut for Version::parse_lenient, VersionReq::parse and VersionReq::matches:
use those directly to check many versions against one requirement.
Import
Section titled “Import”Cargo feature version (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
version | &str | The version to check, such as "1.4.2". |
requirement | &str | The requirement, such as "^1.2" (see [VersionReq] for the syntax). |
Returns
Section titled “Returns”Result<bool, ParseVersionError> — Ok on success, otherwise an Err: see Errors.
Errors
Section titled “Errors”The ParseVersionError of whichever string does not parse.
Examples
Section titled “Examples”Error type: ParseVersionError
Section titled “Error type: ParseVersionError”Why a version or a version requirement could not be parsed.
