Crate check_latest

source ·
Expand description

Examples

The Basics

use check_latest::check_max;

if let Ok(Some(version)) = check_max!() {
    println!("Version {} is now available!", version);
}

Something Slightly More Complicated

use check_latest::*;

if let Ok(available_versions) = Versions::new(crate_name!(), user_agent!()) {
    let current_version = crate_version!();
    let is_yanked = available_versions
        .versions()
        .iter()
        .filter(|version| version.yanked)
        .any(|version| version == current_version);

    if is_yanked {
        println!("This version has been yanked.");
    }
} else {
    eprintln!("We couldn't check for available versions.");
}

Features

blocking

This feature is enabled by default.

Provides the basic usage.

async

Allows you to asynchronously check for available versions. If enabled, it will provide async versions of the macros, which can be used with <macro_name>_async! For example, check_max_async!.

[dependencies.check-latest]
default-features = false # If you want async, you probably don't want blocking
features = ["async"]

Modules

  • Check for version updates with asynchronous requests. Enabled with the async feature
  • Check for version updates with blocking requests. Enabled with the blocking feature

Macros

  • Checks if there is a version available that is greater than the current version.
  • Checks if there is a version available that is greater than the current version.
  • Checks if there is a higher minor version available with the same major version.
  • Checks if there is a higher minor version available with the same major version
  • Checks if there is a higher patch available, within the same major.minor version.
  • Checks if there is a higher patch available, within the same major.minor version.
  • Gets the major version of the crate as defined in your Cargo.toml.
  • Gets the minor version of the crate as defined in your Cargo.toml.
  • Gets the name of the crate as defined in your Cargo.toml.
  • Gets the patch version of the crate as defined in your Cargo.toml.
  • Gets the version of the crate as defined in your Cargo.toml.
  • Helper for creating a new Versions.
  • Helper for creating a new Versions.
  • Defines an appropriate user agent for making requests.

Structs