| Crates.io | update-available |
| lib.rs | update-available |
| version | 0.2.0 |
| created_at | 2025-06-08 14:22:07.316031+00 |
| updated_at | 2025-07-08 17:16:39.981567+00 |
| description | A library to check for updates of a crate on crates.io, GitHub or Gitea. |
| homepage | |
| repository | https://github.com/bircni/update-available |
| max_upload_size | |
| id | 1704926 |
| size | 60,727 |
A Rust library to check for updates of crates on crates.io or GitHub repositories. Get notified when newer versions of your dependencies are available with beautiful, formatted output.
Add this to your Cargo.toml:
[dependencies]
update-available = "0.1.0"
or use cargo add:
cargo add update-available
use update_available::check_crates_io;
match check_crates_io("serde", "1.0.0") {
Ok(info) => {
if info.is_update_available {
println!("{}", info);
} else {
println!("You're using the latest version!");
}
}
Err(e) => eprintln!("Error checking for updates: {}", e),
}
use update_available::check_github;
match check_github("serde", "serde-rs", "1.0.0") {
Ok(info) => println!("{}", info),
Err(e) => eprintln!("Error: {}", e),
}
use update_available::check_gitea;
match check_gitea("my-repo", "username", "https://gitea.example.com", "1.0.0") {
Ok(info) => println!("{}", info),
Err(e) => eprintln!("Error: {}", e),
}
use update_available::{print_check, Source};
// Check crates.io and print result
print_check("serde", "1.0.0", Source::CratesIo);
// Check GitHub and print result
print_check("my-repo", "0.1.0", Source::Github("username".to_string()));
// Check Gitea and print result
print_check("my-repo", "0.1.0", Source::Gitea {
user: "username".to_string(),
base_url: "https://gitea.example.com".to_string(),
});
## Example Output
When an update is available, you'll see beautifully formatted output like this:
```text
🚀 A new version is available!
🔖 Latest version: 1.0.210
📝 Changelog:
• Fixed critical security vulnerability
• Improved performance by 15%
• Added new serialization features
🌐 More info: https://crates.io/crates/example
When you're already using the latest version:
✅ You're already using the latest version! (1.0.210)
check_crates_io(name, current_version) - Check for updates on crates.iocheck_github(name, user, current_version) - Check for updates on GitHubprint_check(name, current_version, source) - Convenience function that prints results directlyUpdateInfo - Contains update information including version details and changelogSource - Enum for specifying update source (CratesIo or Github)UpdateInfois_update_available: bool - Whether an update is availablelatest_version: Version - The latest available versionchangelog: Option<String> - Optional changelog informationurl: String - URL for more informationYou can run the included examples:
# Check crates.io for updates
cargo run --example example
# Run with specific features
cargo run --features blocking --example example
This crate uses feature flags to control functionality:
blocking (default) - Enables blocking HTTP requests using ureq[dependencies]
# Default features (includes blocking)
update-available = "0.1.0"
# Only blocking features
update-available = { version = "0.1.0", features = ["blocking"] }
# No default features
update-available = { version = "0.1.0", default-features = false }
The library uses anyhow::Error for comprehensive error handling. Common error scenarios include:
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
tokio and reqwest