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.