[][src]Crate check_latest

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.

max_minor_versionDeprecated

Makes it easier to run get_max_minor_version.

max_minor_version_asyncDeprecated

Asynchronous version of max_minor_version! View the documentation of max_minor_version! for more information.

max_patchDeprecated

Makes it easier to run get_max_patch.

max_patch_asyncDeprecated

Asynchronous version of max_patch! View the documentation of max_patch! for more information.

max_versionDeprecated

Gets the max version of a crate.

max_version_asyncDeprecated

Asynchronous version of max_version! View the documentation of max_version! for more details.

new_versions

Helper for creating a new Versions.

new_versions_async

Helper for creating a new Versions.

newest_versionDeprecated

Makes it easier to run get_newest_version.

newest_version_asyncDeprecated

Asynchronous version of newest_version!. View the documentation of newest_versions! for full usage.

user_agent

Defines an appropriate user agent for making requests.

versionsDeprecated

Makes it easier to run get_versions.

versions_asyncDeprecated

Asynchronous version of versions!. View the documentation of versions! for full usage.

Structs

MaxAndNewDeprecated

Maintains compatibility with deprecated fns.

Version

A release to Crates.io.

Versions

A collection of Versions.