Skip to main content

Crate tiny_update_check

Crate tiny_update_check 

Source
Expand description

§tiny-update-check

A minimal, lightweight crate update checker for Rust CLI applications.

This crate provides a simple way to check if a newer version of your crate is available on crates.io, with built-in caching to avoid excessive API requests.

§Features

  • Minimal dependencies: Only ureq and semver
  • Small binary impact: ~0.5MB with native-tls (vs ~1.4MB for alternatives)
  • Simple file-based caching: Configurable cache duration (default: 24 hours)
  • TLS flexibility: Choose native-tls (default) or rustls

§Quick Start

use tiny_update_check::UpdateChecker;

let checker = UpdateChecker::new("my-crate", "1.0.0");
if let Ok(Some(update)) = checker.check() {
    eprintln!("Update available: {} -> {}", update.current, update.latest);
}

§With Custom Configuration

use tiny_update_check::UpdateChecker;
use std::time::Duration;

let checker = UpdateChecker::new("my-crate", "1.0.0")
    .cache_duration(Duration::from_secs(60 * 60)) // 1 hour
    .timeout(Duration::from_secs(10));

if let Ok(Some(update)) = checker.check() {
    eprintln!("New version {} released!", update.latest);
}

§Feature Flags

  • native-tls (default): Uses system TLS, smaller binary size
  • rustls: Pure Rust TLS, better for cross-compilation
  • async: Enables async support using reqwest
  • do-not-track (default): Respects DO_NOT_TRACK environment variable

§DO_NOT_TRACK Support

When the do-not-track feature is enabled (default), the checker respects the DO_NOT_TRACK environment variable standard. If DO_NOT_TRACK=1 is set, update checks will return Ok(None) without making network requests.

To disable DO_NOT_TRACK support, disable the feature at compile time:

[dependencies]
tiny-update-check = { version = "0.1", default-features = false, features = ["native-tls"] }

Structs§

UpdateChecker
A lightweight update checker for crates.io.
UpdateInfo
Information about an available update.

Enums§

Error
Errors that can occur during update checking.

Functions§

check
Convenience function to check for updates with default settings.