This file provides guidance to Claude Code when working with tiny-update-check.
A minimal, lightweight crate update checker for Rust CLI applications. Checks crates.io for newer versions with simple file-based caching.
Key design goals:
- Minimal binary size impact (~0.5MB vs ~1.4MB for alternatives)
- Simple API:
check(name, version)or builder pattern - Uses system TLS (
native-tls) by default
just build # Build debug
just test # Run tests
just lint # Run clippy
just check # All local checks
cargo doc --open # View documentationUpdateChecker- Builder struct for configuring update checksUpdateInfo- Return type containing current/latest versions and optional messageError- Error enum for various failure modescheck()- Convenience function for simple use casesr#asyncmodule - Async equivalents (behindasyncfeature)
Minimal by design:
minreq- HTTP client (withnative-tlsorrustlsfeature)semver- Version parsing and comparisonreqwest- Async HTTP client (optional, withasyncfeature)
native-tls(default) - Uses system TLS, smaller binarydo-not-track(default) - Respects theDO_NOT_TRACKenvironment variablerustls- Pure Rust TLS, better cross-compilationasync- Async support usingreqwestresponse-body- Includes raw crates.io response body inUpdateInfo
| File | Purpose |
|---|---|
src/lib.rs |
Sync library code |
src/async.rs |
Async library code (behind async feature) |
tests/integration.rs |
Integration tests |
Cargo.toml |
Package manifest with features |
// Simple usage
if let Ok(Some(update)) = tiny_update_check::check("my-crate", "1.0.0") {
eprintln!("Update: {} -> {}", update.current, update.latest);
}
// Builder pattern
let checker = UpdateChecker::new("my-crate", "1.0.0")
.cache_duration(Duration::from_secs(3600))
.timeout(Duration::from_secs(10))
.include_prerelease(false)
.message_url("https://example.com/update-msg.txt");- Unit tests in
src/lib.rstest configuration and error handling - Integration tests verify API works (network tests are inherently flaky)
- Doc tests ensure examples compile