| Crates.io | updates |
| lib.rs | updates |
| version | 0.2.0 |
| created_at | 2026-01-01 13:35:19.234453+00 |
| updated_at | 2026-01-05 00:17:37.213027+00 |
| description | A Rust library that checks for crate updates. |
| homepage | |
| repository | https://codeberg.org/rly0nheart/updates-rs |
| max_upload_size | |
| id | 2016167 |
| size | 53,311 |
A Rust library that checks for crate updates.
[!Note] updates-rs only checks crates that are publicly listed on crates.io.
Run the following command to add updates to your project's dependencies:
cargo add updates
The easiest way to use this crate is with the check() function:
fn main() {
// Check for updates at startup
updates::check(
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"),
false // use cache
);
// Your application code here...
println!("Hello, world!");
}
If an update is available, it will print to stderr:
Version 1.0.0 of my-tool is outdated. Version 1.2.0 was released 3 days ago.
For more control over the checking process, use [UpdateChecker] directly:
use updates::UpdateChecker;
fn main() {
let checker = UpdateChecker::new(false);
match checker.check("serde", "1.0.150") {
Some(update) => {
println!("Update available!");
println!("Current version: {}", update.running_version);
println!("Latest version: {}", update.available_version);
if let Some(date) = update.release_date {
println!("Released: {}", date);
}
}
None => {
println!("You're on the latest version!");
}
}
}
If you need to always get the latest information (e.g., in a CI environment),
set bypass_cache to true:
use updates::update_check;
fn main() {
// Always query crates.io, ignore cache
update_check("my-tool", "1.0.0", true);
}
Update checks are cached in your system's temp directory for 1 hour:
{temp_dir}/updates_cache.binThe cache is automatically shared across multiple runs of your application, so users won't be spammed with update checks every time they run your program.