[][src]Function check_latest::async::get_max_version

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

Please use Versions struct

NOTE You probably want to use max_version_async!

Compares the current crate version to the maximum version available on Crates.io.

Returns

  • Ok(Some(version)) if the current version < max version
  • `Ok(None) if current version >= max version
  • Err(_) if there was a failure to get and compare the versions

Example

use check_latest::r#async::get_max_version;

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

if let Ok(Some(version)) = get_max_version(name, version, &user_agent).await {
    println!("Go get version {}!", version);
}