check-latest

Crates.iocheck-latest
lib.rscheck-latest
version1.0.2
sourcesrc
created_at2020-01-25 22:30:34.375916
updated_at2023-06-29 18:49:25.617863
descriptionCheck if your rust executable is the latest available version
homepage
repositoryhttps://github.com/spenserblack/check-latest-rs
max_upload_size
id201970
size72,158
Spenser Black (spenserblack)

documentation

README

check-latest

Crates.io Docs.rs Crates.io CI

Check if your rust executable is the latest available version on Crates.io

The Basics

use check_latest::check_max;

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

Please check the examples and the documentation For more usage.

Features

This crate has two features: async and blocking. By default, blocking is enabled and async is disabled. This default is compatible with the example in the section titled The Basics. If you want to use asynchronous requests, you can swap these features with the following in you Cargo.toml.

[dependencies.check-latest]
version = "*"
default-features = false
features = ["async"]

NOTE There's nothing stopping you from enabling both async and blocking, but that's unlikely to be necessary.

Notes

Making this Library Optional

If you use this library for your binary, you should probably make this an optional feature. Simply checking for the latest version on Crates.io brings over a lot of dependencies in order to send a request to the API and parse the response. Some users may want to turn off this feature for a smaller binary. Some may simply prefer not to be told to install an update.

You can make this feature optional by adding this to your Cargo.toml.

[dependencies.check-latest]
version = "*"
optional = true

To selectively compile the parts of your binary that check for later releases, add this attribute to the parts that should be compiled if this feature is enabled.

#[cfg(feature = "check-latest")]
Commit count: 179

cargo fmt