[−][src]Function check_latest::async::get_max_patch
pub async fn get_max_patch<'_, '_, '_>(
crate_name: &'_ str,
version: &'_ str,
user_agent: &'_ str
) -> Result<Option<Version>>
Deprecated since 0.4:
Please use Versions struct
Gets the largest patch available with the same major and minor version.
NOTE You probably want to use max_patch_async!
crate_name
: The crate that the version should be checked for.version
: The version to be compared against.user_agent
: without a proper User-Agent, the request to the Crates.io API will result in the following response, which we won't be able to parse into crate versions.
Returns
If version
is x.y.z
and the max available patch is x.y.c
.
Ok(Some(version))
ifz
<c
Ok(None) if
z>=
c`Err(_)
if there was a failure to get and compare the versions
Example
use check_latest::r#async::get_max_patch; let crate_name = "my-awesome-crate-bin"; let version = "1.0.0"; let user_agent = format!("{}/{}", crate_name, version); let result = get_max_patch(crate_name, version, &user_agent); if let Ok(Some(higher_patch)) = result.await { println!("A new patch has been released: {}", higher_patch); }