[][src]Function check_latest::async::get_max_minor_version

pub async fn get_max_minor_version<'_, '_, '_>(
    crate_name: &'_ str,
    version: &'_ str,
    user_agent: &'_ str
) -> Result<Option<Version>>
Deprecated since 0.4:

Please use Versions struct

Gets the largest minor version available with the same major version.

NOTE You probably want to use max_minor_version_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 minor version is x.b.c.

  • Ok(Some(version)) if y.z < b.c
  • Ok(None) if y.z>=b.c`
  • Err(_) if there was a failure to get and compare the versions

Example

use check_latest::r#async::get_max_minor_version;

let crate_name = "my-awesome-crate-bin";
let version = "1.0.0";
let user_agent = format!("{}/{}", crate_name, version);

let result = get_max_minor_version(crate_name, version, &user_agent);

if let Ok(Some(higher_minor_version)) = result.await {
    println!("A new minor version is available: {}", higher_minor_version);
}