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§

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

Macros§

check_max
Checks if there is a version available that is greater than the current version.
check_max_async
Checks if there is a version available that is greater than the current version.
check_minor
Checks if there is a higher minor version available with the same major version.
check_minor_async
Checks if there is a higher minor version available with the same major version
check_patch
Checks if there is a higher patch available, within the same major.minor version.
check_patch_async
Checks if there is a higher patch available, within the same major.minor version.
crate_major_version
Gets the major version of the crate as defined in your Cargo.toml.
crate_minor_version
Gets the minor version of the crate as defined in your Cargo.toml.
crate_name
Gets the name of the crate as defined in your Cargo.toml.
crate_patch
Gets the patch version of the crate as defined in your Cargo.toml.
crate_version
Gets the version of the crate as defined in your Cargo.toml.
new_versions
Helper for creating a new Versions.
new_versions_async
Helper for creating a new Versions.
user_agent
Defines an appropriate user agent for making requests.

Structs§

Version
A release to Crates.io.
Versions
A collection of Versions.